Crates.io | colorstyle |
lib.rs | colorstyle |
version | 1.0.2 |
source | src |
created_at | 2021-09-05 09:01:51.489881 |
updated_at | 2021-09-13 02:15:23.478056 |
description | ColorStyle is a library of styles for command-line text.ColorStyle 是一个用于命令行文本的样式库。 |
homepage | https://colorstyle.ffactory.org |
repository | https://github.com/code-translation/colorstyle |
max_upload_size | |
id | 447082 |
size | 56,342 |
colorStyle is a library of styles for command-line text.
Inspired by flylog/colorstyle (golang)
let text = colorstyle::green("green");
println!("a {} text", text);
let text = colorstyle::blue("Blue");
println!("a {} text\n", text);
let text = colorstyle::CSS::new().color_red().sprint("red");
println!("a {} text",text);
colorstyle::CSS::new().style_italic().color_red().bg_yellow().println("a italic red bgYellow text: Hello 世界!");
colorstyle::CSS::new().style_bold().println("a bold text: Hello 世界!");
colorstyle::CSS::new().style_italic().println("a italic text: Hello 世界!");
colorstyle::CSS::new().color_magenta().println("a magenta text: Hello 世界!");
colorstyle::CSS::new().bg_cyan().println("a background color cyan text: Hello 世界!");
colorstyle::CSS::new().bg_cyan().println("a background color cyan text");
let mut css = colorstyle::CSS::new();
css.style_strikethrough().println("删除线文本");
css.style_underline().println("下划线文本");
css.style_reverse().println("反显文本");
See this document at API documentation