Crossterm Style | cross-platform styling.

Lines of Code Latest Version MIT docs Lines of Code

This crate allows you to style te terminal cross-platform. It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see Tested Terminals for more info)

This crate is a sub-crate of crossterm to style te terminal, and can be use individually.

Other sub-crates are: - Crossterm Input - Crossterm Terminal - Crossterm Screen - Crossterm Cursor

When you want to use other modules as well you might want to use crossterm with feature flags

Table of contents:

Getting Started

This documentation is only for crossterm_style version 0.1 if you have an older version I suggest you check the Upgrade Manual. Also, check out the examples folders with detailed examples for all functionality of this crate.

Add the crossterm_style package to your Cargo.toml file.

`` [dependencies] crossterm_style` = "0.1"

`` And import thecrossterm_style` modules you want to use.

```rust
extern crate crossterm_style;

pub use crossterm_style::{color, style, Attribute, Color, ColorType, ObjectStyle, StyledObject, TerminalColor}; ```

Useful Links

Features

These are the features of this crate:

Planned features: - Easier usage; e.g. println!("{}Bold{}Blue", Attribute::Bold, Color::Blue)

Examples

Check out the examples for more information about how to use this crate. ```rust
use crossterm::style::{Color, style};

// store objcets so it could be painted later to the screen.
let style1 = style("Some Blue font on Black background").with(Color::Blue).on(Color::Black); let style2 = style("Some Red font on Yellow background").with(Color::Red).on(Color::Yellow);

// syling font with (Windows 10 and UNIX systems) let normal = style("Normal text"); let bold = style("Bold text").bold(); let italic = style("Italic text").italic(); let slowblink = style("Slow blinking text").slowblink(); let rapidblink = style("Rapid blinking text").rapidblink(); let hidden = style("Hidden text").hidden(); let underlined = style("Underlined text").underlined(); let reversed = style("Reversed text").reverse(); let dimmed = style("Dim text").dim(); let crossedout = style("Crossed out font").crossedout();

// paint styled text to screen (this could also be called inline) println!("{}", style1); println!("{}", style2); println!("{}", bold); println!("{}", hidden); ...

// cursom rgb value (Windows 10 and UNIX systems) style("RGB color (10,10,10) ").with(Color::Rgb { r: 10, g: 10, b: 10 }));

// custom ansi color value (Windows 10 and UNIX systems) style("ANSI color value (50) ").with(Color::AnsiValue(50));

```

Tested terminals

This crate supports all Unix terminals and windows terminals down to Windows 7 but not all of them have been tested. If you have used this library for a terminal other than the above list without issues feel free to add it to the above list, I really would appreciate it.

Notice

This library is average stable now, I don't expect it to not to change that much. If there are any changes that will affect previous versions I will describe what to change to upgrade.

Contributing

I highly appreciate it when you are contributing to this crate. Also Since my native language is not English my grammar and sentence order will not be perfect. So improving this by correcting these mistakes will help both me and the reader of the docs.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details