[][src]Function crossterm_style::color

pub fn color() -> TerminalColor

Creates a new TerminalColor.

Examples

Basic usage:

use crossterm_style::{color, Color, Result};

fn main() -> Result<()> {
    let color = color();
    // Set foreground color
    color.set_fg(Color::Blue)?;
    // Set background color
    color.set_bg(Color::Red)?;
    // Reset to the default colors
    color.reset()
}