designify your terminal with a large ansi colors palette π¨
Examples β API β Goals β License
a nice ANSI escape codes API
to use ansi color in a elegant way that support 8 color, 16 color, 88 color, 256 color and 16 millions color mode. You can manage the color mode by yourself, you got the control dude!
snippet
extern crate qute;
use qute::prelude::*;
fn main () {
let quted = qute!("my string").background_black().white();
println!("{}", quted);
}
extern crate qute;
use qute::prelude::*;
fn main () {
let quted = style!({
value: "my string";
color: "purple";
background: "black";
font-weight: none;
});
println!("{}", quted);
}
cargo
example | command |
---|---|
256 | cargo run --example hello_colors |
basic | cargo run --example basic |
css | cargo run --example css |
rgb | cargo run --example rgb |
Add the following to your Cargo.toml:
[dependencies]
qute = "0.0.13"
Now you can use the crate in your code
extern crate qute;
the qute!
macro contains all method to designify your terminal as you want. Select Graphic Rendition
are parameters applied into the escape sequence format string. See the SGR
table below
no params
returns
self
{ Designer }: the current instance
no params
returns
self
{ Designer }: the current instance
no params
returns
self
{ Designer }: the current instance
params
n
{ u8 }: the color number - from 0 to 255
returns
self
{ Designer }: the current instance
mode | snippet | preview |
---|---|---|
foreground | qute!("my string").set_color(231) |
|
background | qute!("my string").set_background(220) |
params
r
{ u8 }: the standard red
g
{ u8 }: the standard green
b
{ u8 }: the standard blue
returns
self
{ Designer }: the current instance
mode | snippet | preview |
---|---|---|
foreground | qute!("my string").set_rgb_color(255, 255, 255) |
|
background | qute!("my string").set_rgb_background(128, 128, 128) |
CSS colors keyword are supported. See the complete list here
params
keyword
{ String }: the css color keyword
returns
self
{ Designer }: the current instance
mode | snippet | preview |
---|---|---|
foreground | qute!("my string").set_css_color("lime") |
|
background | qute!("my string").set_css_background("aquamarine") |
- support modifiers
- support vga
- support rgb
- support css colors keywords
- unit testing (wip)
- support hexa
- support hsl
- force color
- convert to css
- cross platform
- documentation
Copyright Β©οΈ 2020 Qurity
Released under the MIT license