LeonDev13/zig-colors
Zig-Colors offers full color support with a chainable API, zero dependencies, and cross-platform compatibility. Perfect for enhancing terminal output!...
Zig Colors offers a vibrant set of terminal colors for Zig applications. With a focus on simplicity and cross-platform compatibility, this library allows developers to easily style console output. Whether you want to enhance your terminal user interface (TUI) or just make your logs more colorful, Zig Colors has you covered.
For the latest releases, visit Releases.
To get started with Zig Colors, download the latest release from the Releases section. After downloading, follow these steps:
This will set up Zig Colors in your development environment.
Using Zig Colors is straightforward. First, import the library into your Zig project. Here’s a simple example:
const std = @import("std");
const colors = @import("zig_colors");
pub fn main() void {
std.debug.print("{}\n", .{colors.red("This text is red!")});
std.debug.print("{}\n", .{colors.green("This text is green!")});
std.debug.print("{}\n", .{colors.blue("This text is blue!")});
}
In this example, we import the zig_colors
module and use its functions to print colored text to the console.
Here are a few more examples to illustrate the capabilities of Zig Colors:
const std = @import("std");
const colors = @import("zig_colors");
pub fn main() void {
std.debug.print("{}\n", .{colors.yellow("This text is yellow!")});
std.debug.print("{}\n", .{colors.cyan("This text is cyan!")});
}
You can also define custom colors using RGB values:
const std = @import("std");
const colors = @import("zig_colors");
pub fn main() void {
const customColor = colors.rgb(255, 165, 0); // Orange
std.debug.print("{}\n", .{customColor("This text is orange!")});
}
For those who prefer hex codes:
const std = @import("std");
const colors = @import("zig_colors");
pub fn main() void {
const hexColor = colors.hex("#FF5733"); // A shade of red
std.debug.print("{}\n", .{hexColor("This text is red from hex!")});
}
Contributions are welcome! If you want to improve Zig Colors, follow these steps:
Please ensure your code follows the project's style guidelines and includes tests where applicable.
Zig Colors is licensed under the MIT License. See the LICENSE file for details.
For questions or suggestions, feel free to reach out:
For the latest updates and releases, check the Releases section.