[go: up one dir, main page]

Function color

Source
pub fn color() -> TerminalColor
Expand description

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()
}