Crossterm Style
The crossterm_style
crate is deprecated and no longer maintained. The GitHub repository will
be archived soon. All the code is being moved to the crossterm
crate. You can learn more in the
Merge sub-crates to the crossterm crate
issue.
This crate allows you to work with the terminal colors and text attributes. It supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested, see the Tested Terminals for more info).
crossterm_style
is a sub-crate of the crossterm crate. You can use it
directly, but it's highly recommended to use the crossterm crate with
the style
feature enabled.
Features
- Cross-platform
- Multi-threaded (send, sync)
- Detailed documentation
- Few dependencies
- Styled output
- Foreground color (16 base colors)
- Background color (16 base colors)
- 256 (ANSI) color support (Windows 10 and UNIX only)
- RGB color support (Windows 10 and UNIX only)
- Text attributes like bold, italic, underscore, crossed word, etc.
Getting Started
[]
# All crossterm features are enabled by default.
= "0.11"
Attributes
use ;
// pass any `Attribute` value to the formatting braces.
println!;
// you could also call different attribute methods on a `&str` and keep on chaining if needed.
let styled_text = "Bold Underlined".bold.underlined;
println!;
// old-way but still usable
let styled_text = style.bold.underlined;
Colors
use ;
println!;
println!;
// you can also call different coloring methods on a `&str`.
let styled_text = "Bold Underlined".red.on_blue;
println!;
// old-way but still usable
let styled_text = style.with.on;
RGB Colors and ANSI Values
use ;
// custom rgb value (Windows 10 and UNIX systems)
println!;
// custom ansi color value (Windows 10 and UNIX systems)
println!;
Other Resources
- API documentation (with other examples)
- Examples repository
Authors
- Timon Post - Project Owner & creator
License
This project is licensed under the MIT License - see the LICENSE file for details