[][src]Trait crossterm::style::Colorize

pub trait Colorize<D: Display + Clone> {
    pub fn black(self) -> StyledContent<D>;
pub fn dark_grey(self) -> StyledContent<D>;
pub fn red(self) -> StyledContent<D>;
pub fn dark_red(self) -> StyledContent<D>;
pub fn green(self) -> StyledContent<D>;
pub fn dark_green(self) -> StyledContent<D>;
pub fn yellow(self) -> StyledContent<D>;
pub fn dark_yellow(self) -> StyledContent<D>;
pub fn blue(self) -> StyledContent<D>;
pub fn dark_blue(self) -> StyledContent<D>;
pub fn magenta(self) -> StyledContent<D>;
pub fn dark_magenta(self) -> StyledContent<D>;
pub fn cyan(self) -> StyledContent<D>;
pub fn dark_cyan(self) -> StyledContent<D>;
pub fn white(self) -> StyledContent<D>;
pub fn grey(self) -> StyledContent<D>;
pub fn on_black(self) -> StyledContent<D>;
pub fn on_dark_grey(self) -> StyledContent<D>;
pub fn on_red(self) -> StyledContent<D>;
pub fn on_dark_red(self) -> StyledContent<D>;
pub fn on_green(self) -> StyledContent<D>;
pub fn on_dark_green(self) -> StyledContent<D>;
pub fn on_yellow(self) -> StyledContent<D>;
pub fn on_dark_yellow(self) -> StyledContent<D>;
pub fn on_blue(self) -> StyledContent<D>;
pub fn on_dark_blue(self) -> StyledContent<D>;
pub fn on_magenta(self) -> StyledContent<D>;
pub fn on_dark_magenta(self) -> StyledContent<D>;
pub fn on_cyan(self) -> StyledContent<D>;
pub fn on_dark_cyan(self) -> StyledContent<D>;
pub fn on_white(self) -> StyledContent<D>;
pub fn on_grey(self) -> StyledContent<D>; }

Provides a set of methods to set the colors.

Every method with the on_ prefix sets the background color. All other methods set the foreground color.

Method names correspond to the Color enum variants.

Examples

use crossterm::style::Colorize;

let styled_text = "Red foreground color on blue background.".red().on_blue();
println!("{}", styled_text);

Required methods

pub fn black(self) -> StyledContent<D>[src]

pub fn dark_grey(self) -> StyledContent<D>[src]

pub fn red(self) -> StyledContent<D>[src]

pub fn dark_red(self) -> StyledContent<D>[src]

pub fn green(self) -> StyledContent<D>[src]

pub fn dark_green(self) -> StyledContent<D>[src]

pub fn yellow(self) -> StyledContent<D>[src]

pub fn dark_yellow(self) -> StyledContent<D>[src]

pub fn blue(self) -> StyledContent<D>[src]

pub fn dark_blue(self) -> StyledContent<D>[src]

pub fn magenta(self) -> StyledContent<D>[src]

pub fn dark_magenta(self) -> StyledContent<D>[src]

pub fn cyan(self) -> StyledContent<D>[src]

pub fn dark_cyan(self) -> StyledContent<D>[src]

pub fn white(self) -> StyledContent<D>[src]

pub fn grey(self) -> StyledContent<D>[src]

pub fn on_black(self) -> StyledContent<D>[src]

pub fn on_dark_grey(self) -> StyledContent<D>[src]

pub fn on_red(self) -> StyledContent<D>[src]

pub fn on_dark_red(self) -> StyledContent<D>[src]

pub fn on_green(self) -> StyledContent<D>[src]

pub fn on_dark_green(self) -> StyledContent<D>[src]

pub fn on_yellow(self) -> StyledContent<D>[src]

pub fn on_dark_yellow(self) -> StyledContent<D>[src]

pub fn on_blue(self) -> StyledContent<D>[src]

pub fn on_dark_blue(self) -> StyledContent<D>[src]

pub fn on_magenta(self) -> StyledContent<D>[src]

pub fn on_dark_magenta(self) -> StyledContent<D>[src]

pub fn on_cyan(self) -> StyledContent<D>[src]

pub fn on_dark_cyan(self) -> StyledContent<D>[src]

pub fn on_white(self) -> StyledContent<D>[src]

pub fn on_grey(self) -> StyledContent<D>[src]

Loading content...

Implementations on Foreign Types

impl Colorize<String> for String[src]

impl Colorize<char> for char[src]

impl<'a> Colorize<&'a str> for &'a str[src]

Loading content...

Implementors

impl<D: Display + Clone> Colorize<D> for StyledContent<D>[src]

Loading content...