Crate colorstyle

Crate colorstyle 

Source
Expand description

ColorStyle is a library of styles for command-line text. Used to modify the style of text for standard output to the terminal interface, you can change the foreground colour of the text, the background colour, add underline and bold, etc.

ColorStyle 是一个用于命令行文本的样式库。 用于标准输出到终端界面的文本的样式修改,可以修改文本前景色,背景色,增加下划线和加粗显等。

§Example

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("反显文本");

Structs§

CSS

Enums§

BgColor
FgColor
Style

Functions§

black
生成黑色的文本
blue
生成蓝色的文本
bright_blue
生成亮蓝的文本
bright_cyan
生成亮青色的文本
bright_magenta
生成亮品红的文本
bright_red
生成亮红色的文本
bright_white
生成亮白色的文本
bright_yellow
生成亮黄色的文本
cyan
生成青色的文本
gray
生成灰色的文本
green
生成绿色的文本
magenta
生成品红色的文本
red
生成红色的文本
white
生成白色的文本
yellow
生成黄色的文本