Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeremyletang/colorize
Simple ansi color library
https://github.com/jeremyletang/colorize
Last synced: 1 day ago
JSON representation
Simple ansi color library
- Host: GitHub
- URL: https://github.com/jeremyletang/colorize
- Owner: jeremyletang
- License: mit
- Created: 2014-02-23T01:52:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-01T16:45:20.000Z (over 8 years ago)
- Last Synced: 2024-10-31T19:41:51.853Z (8 days ago)
- Language: Rust
- Homepage:
- Size: 30.3 KB
- Stars: 16
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
colorize
========__libcolorize__ provide simple text colorization for terminal emulator, using ansi escape characters.
To build __libcolorize__ just do :
```Shell
> rustc lib.rs
```__libcolorize__ is really simple to use, see this short example !
```Rust
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());
}```