Expand description
A silly little library for printing kolored text to the terminal
§Installation
Add kolorz to your project’s Cargo.toml:
[dependencies]
kolorz = "1.1.1"§Basic Usage
use kolorz::Kolor;
fn main() {
let mocha = Kolor::new("catppuccin mocha").expect("Invalid kolorscheme");
println!("{}", mocha.red("This is red"));
}§The following kolorschemes are available:
- catppuccin latte
- catppuccin frappe
- catppuccin macchiato
- catppuccin mocha
- dracula
- nord
- gruvbox dark
- gruvbox light
- onedark
- tokyonight
- ayu
- palenight
- gogh
- biscuit dark
- biscuit light
§The following colors are available on all of the kolorschemes:
- red (0)
- purple (1)
- blue (2)
- green (3)
- orange (4)
- yellow (5)
- text (6)
- random (picks a random color from above)
- numbered (allows the user to pick a kolor by number)
§Kustom Kolorz are also available
// If the hex code is invalid, the text will not be colored
use kolorz::HexKolorize;
fn main() {
println!("{}", "This is peach".kolorize("#fab387"));
}use kolorz::RGBKolorize;
fn main() {
println!("{}", "This is red".kolorize((235, 160, 172)));
}Re-exports§
pub use errors::InvalidColorNumberError;pub use errors::UnknownKolorSchemeError;pub use hex::HexKolorize;pub use rgb::RGBKolorize;
Modules§
Structs§
Enums§
Functions§
- colors_
enabled - Determines if colors should be used based on the CLICOLORS spec.