1 个不稳定版本

使用旧的 Rust 2015

0.1.0 2016年7月1日

#992命令行界面

Download history 245/week @ 2024-03-13 363/week @ 2024-03-20 364/week @ 2024-03-27 257/week @ 2024-04-03 427/week @ 2024-04-10 337/week @ 2024-04-17 307/week @ 2024-04-24 272/week @ 2024-05-01 353/week @ 2024-05-08 230/week @ 2024-05-15 251/week @ 2024-05-22 179/week @ 2024-05-29 265/week @ 2024-06-05 140/week @ 2024-06-12 272/week @ 2024-06-19 207/week @ 2024-06-26

923 每月下载次数
用于 22 个 crate(16 直接使用)

22KB
385

colorize

libcolorize 提供简单的终端仿真器文本着色,使用 ansi 转义字符。

要构建 libcolorize,只需执行

> rustc lib.rs

libcolorize 使用非常简单,请看这个简短的示例!

extern crate colorize;
// Import the trait implemented for &'static str and ~str
use colorize::AnsiColor;
// Import the colors for the global
use colorize::{BrightRed, Blue};

pub fn main() {
    // Set some global colors
    colorize::global_fg(BrightRed);
    colorize::global_bg(Blue);
    // ^~~~ These settings are reset to default at the end.

    // You can use specific colors or style on a given str,
    // the globals colors are restored after !

    // Write a green underlined text on a yellow background !
    println!("{}", "Hello World !".green().underlined().yellowb());

    // Use bright or normal colors
    println!("{}", "Bright Green foreground and Magenta background !".b_green().magentab());
}

无运行时依赖