Function kdam::term::colour

source ·
pub fn colour(code: &str) -> Option<String>
Expand description

Create ANSI colour escape code from primary colours, hex code, rgb(r,g,b) and ansi(n).

§Example

use kdam::term::colour;

assert_eq!(colour("bold red"), Some("\x1b[31;1m".to_owned()));
assert_eq!(colour("blue on white"), Some("\x1b[34;47m".to_owned()));