use std::fmt::Display; use super::StyledContent; /// 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.Color.html) enum variants. /// /// # Examples /// /// ```no_run /// use crossterm::style::Colorize; /// /// let styled_text = "Red foreground color on blue background.".red().on_blue(); /// println!("{}", styled_text); /// ``` pub trait Colorize { fn black(self) -> StyledContent; fn dark_grey(self) -> StyledContent; fn red(self) -> StyledContent; fn dark_red(self) -> StyledContent; fn green(self) -> StyledContent; fn dark_green(self) -> StyledContent; fn yellow(self) -> StyledContent; fn dark_yellow(self) -> StyledContent; fn blue(self) -> StyledContent; fn dark_blue(self) -> StyledContent; fn magenta(self) -> StyledContent; fn dark_magenta(self) -> StyledContent; fn cyan(self) -> StyledContent; fn dark_cyan(self) -> StyledContent; fn white(self) -> StyledContent; fn grey(self) -> StyledContent; fn on_black(self) -> StyledContent; fn on_dark_grey(self) -> StyledContent; fn on_red(self) -> StyledContent; fn on_dark_red(self) -> StyledContent; fn on_green(self) -> StyledContent; fn on_dark_green(self) -> StyledContent; fn on_yellow(self) -> StyledContent; fn on_dark_yellow(self) -> StyledContent; fn on_blue(self) -> StyledContent; fn on_dark_blue(self) -> StyledContent; fn on_magenta(self) -> StyledContent; fn on_dark_magenta(self) -> StyledContent; fn on_cyan(self) -> StyledContent; fn on_dark_cyan(self) -> StyledContent; fn on_white(self) -> StyledContent; fn on_grey(self) -> StyledContent; } /// Provides a set of methods to set the text attributes. /// /// Method names correspond to the [`Attribute`](enum.Attribute.html) enum variants. /// /// # Examples /// /// ```no_run /// use crossterm::style::Styler; /// /// println!("{}", "Bold text".bold()); /// println!("{}", "Underlined text".underlined()); /// println!("{}", "Negative text".negative()); /// ``` pub trait Styler { fn reset(self) -> StyledContent; fn bold(self) -> StyledContent; fn underlined(self) -> StyledContent; fn reverse(self) -> StyledContent; fn dim(self) -> StyledContent; fn italic(self) -> StyledContent; fn negative(self) -> StyledContent; fn slow_blink(self) -> StyledContent; fn rapid_blink(self) -> StyledContent; fn hidden(self) -> StyledContent; fn crossed_out(self) -> StyledContent; }