🦎 Terminal string styling for zig.
Currently the only fully featured terminal color solution for zig. âš¡
- Expressive API
- Highly performant
- Ability to nest styles
- Ability for custom themes
- No dependencies
- Clean and focused
- Truecolor support
- 140+ built in color presets
-
Install the package.
zig fetch --save git+https://github.com/tr1ckydev/chameleon
-
Add the package in
build.zig
.const cham = b.dependency("chameleon", .{}); exe.root_module.addImport("chameleon", cham.module("chameleon"));
-
Import it in your project.
const Chameleon = @import("chameleon");
Chameleon is divided into two APIs — Comptime and Runtime.
- Comptime: The comptime API is simplest way to implement colors in your terminal.
- Runtime: The runtime API is much more flexible and is the recommended way when building for production.
At the end, choose what fits best for your use case.
Check out the full documentation here.
According to no-color.org, "Command-line software which adds ANSI color to its output by default should check for a
NO_COLOR
environment variable that, when present and not an empty string (regardless of its value), prevents the addition of ANSI color."
Chameleon supports this standard only in it's Runtime API by detecting the presence of the NO_COLOR environment variable (regardless of it's value), if present disables any ANSI colors or styles, and can also be configured to not do so if you want to implement a different way of detection, although highly not recommended.
This repository uses the MIT License. Check LICENSE for full license text.