Trait crossterm::style::Stylize

source ·
pub trait Stylize: Sized {
    type Styled: AsRef<ContentStyle> + AsMut<ContentStyle>;

Show 64 methods // Required method fn stylize(self) -> Self::Styled; // Provided methods fn with(self, color: Color) -> Self::Styled { ... } fn on(self, color: Color) -> Self::Styled { ... } fn underline(self, color: Color) -> Self::Styled { ... } fn attribute(self, attr: Attribute) -> Self::Styled { ... } fn reset(self) -> Self::Styled { ... } fn bold(self) -> Self::Styled { ... } fn underlined(self) -> Self::Styled { ... } fn reverse(self) -> Self::Styled { ... } fn dim(self) -> Self::Styled { ... } fn italic(self) -> Self::Styled { ... } fn negative(self) -> Self::Styled { ... } fn slow_blink(self) -> Self::Styled { ... } fn rapid_blink(self) -> Self::Styled { ... } fn hidden(self) -> Self::Styled { ... } fn crossed_out(self) -> Self::Styled { ... } fn black(self) -> Self::Styled { ... } fn on_black(self) -> Self::Styled { ... } fn underline_black(self) -> Self::Styled { ... } fn dark_grey(self) -> Self::Styled { ... } fn on_dark_grey(self) -> Self::Styled { ... } fn underline_dark_grey(self) -> Self::Styled { ... } fn red(self) -> Self::Styled { ... } fn on_red(self) -> Self::Styled { ... } fn underline_red(self) -> Self::Styled { ... } fn dark_red(self) -> Self::Styled { ... } fn on_dark_red(self) -> Self::Styled { ... } fn underline_dark_red(self) -> Self::Styled { ... } fn green(self) -> Self::Styled { ... } fn on_green(self) -> Self::Styled { ... } fn underline_green(self) -> Self::Styled { ... } fn dark_green(self) -> Self::Styled { ... } fn on_dark_green(self) -> Self::Styled { ... } fn underline_dark_green(self) -> Self::Styled { ... } fn yellow(self) -> Self::Styled { ... } fn on_yellow(self) -> Self::Styled { ... } fn underline_yellow(self) -> Self::Styled { ... } fn dark_yellow(self) -> Self::Styled { ... } fn on_dark_yellow(self) -> Self::Styled { ... } fn underline_dark_yellow(self) -> Self::Styled { ... } fn blue(self) -> Self::Styled { ... } fn on_blue(self) -> Self::Styled { ... } fn underline_blue(self) -> Self::Styled { ... } fn dark_blue(self) -> Self::Styled { ... } fn on_dark_blue(self) -> Self::Styled { ... } fn underline_dark_blue(self) -> Self::Styled { ... } fn magenta(self) -> Self::Styled { ... } fn on_magenta(self) -> Self::Styled { ... } fn underline_magenta(self) -> Self::Styled { ... } fn dark_magenta(self) -> Self::Styled { ... } fn on_dark_magenta(self) -> Self::Styled { ... } fn underline_dark_magenta(self) -> Self::Styled { ... } fn cyan(self) -> Self::Styled { ... } fn on_cyan(self) -> Self::Styled { ... } fn underline_cyan(self) -> Self::Styled { ... } fn dark_cyan(self) -> Self::Styled { ... } fn on_dark_cyan(self) -> Self::Styled { ... } fn underline_dark_cyan(self) -> Self::Styled { ... } fn white(self) -> Self::Styled { ... } fn on_white(self) -> Self::Styled { ... } fn underline_white(self) -> Self::Styled { ... } fn grey(self) -> Self::Styled { ... } fn on_grey(self) -> Self::Styled { ... } fn underline_grey(self) -> Self::Styled { ... }
}
Expand description

Provides a set of methods to set attributes and colors.

§Examples

use crossterm::style::Stylize;

println!("{}", "Bold text".bold());
println!("{}", "Underlined text".underlined());
println!("{}", "Negative text".negative());
println!("{}", "Red on blue".red().on_blue());

Required Associated Types§

source

type Styled: AsRef<ContentStyle> + AsMut<ContentStyle>

This type with styles applied.

Required Methods§

source

fn stylize(self) -> Self::Styled

Styles this type.

Provided Methods§

source

fn with(self, color: Color) -> Self::Styled

Sets the foreground color.

source

fn on(self, color: Color) -> Self::Styled

Sets the background color.

source

fn underline(self, color: Color) -> Self::Styled

Sets the underline color.

source

fn attribute(self, attr: Attribute) -> Self::Styled

Styles the content with the attribute.

source

fn reset(self) -> Self::Styled

Applies the Reset attribute to the text.

source

fn bold(self) -> Self::Styled

Applies the Bold attribute to the text.

source

fn underlined(self) -> Self::Styled

Applies the Underlined attribute to the text.

source

fn reverse(self) -> Self::Styled

Applies the Reverse attribute to the text.

source

fn dim(self) -> Self::Styled

Applies the Dim attribute to the text.

source

fn italic(self) -> Self::Styled

Applies the Italic attribute to the text.

source

fn negative(self) -> Self::Styled

Applies the Reverse attribute to the text.

Applies the SlowBlink attribute to the text.

Applies the RapidBlink attribute to the text.

source

fn hidden(self) -> Self::Styled

Applies the Hidden attribute to the text.

source

fn crossed_out(self) -> Self::Styled

Applies the CrossedOut attribute to the text.

source

fn black(self) -> Self::Styled

Sets the foreground color to Black.

source

fn on_black(self) -> Self::Styled

Sets the background color to Black.

source

fn underline_black(self) -> Self::Styled

Sets the underline color to Black.

source

fn dark_grey(self) -> Self::Styled

Sets the foreground color to DarkGrey.

source

fn on_dark_grey(self) -> Self::Styled

Sets the background color to DarkGrey.

source

fn underline_dark_grey(self) -> Self::Styled

Sets the underline color to DarkGrey.

source

fn red(self) -> Self::Styled

Sets the foreground color to Red.

source

fn on_red(self) -> Self::Styled

Sets the background color to Red.

source

fn underline_red(self) -> Self::Styled

Sets the underline color to Red.

source

fn dark_red(self) -> Self::Styled

Sets the foreground color to DarkRed.

source

fn on_dark_red(self) -> Self::Styled

Sets the background color to DarkRed.

source

fn underline_dark_red(self) -> Self::Styled

Sets the underline color to DarkRed.

source

fn green(self) -> Self::Styled

Sets the foreground color to Green.

source

fn on_green(self) -> Self::Styled

Sets the background color to Green.

source

fn underline_green(self) -> Self::Styled

Sets the underline color to Green.

source

fn dark_green(self) -> Self::Styled

Sets the foreground color to DarkGreen.

source

fn on_dark_green(self) -> Self::Styled

Sets the background color to DarkGreen.

source

fn underline_dark_green(self) -> Self::Styled

Sets the underline color to DarkGreen.

source

fn yellow(self) -> Self::Styled

Sets the foreground color to Yellow.

source

fn on_yellow(self) -> Self::Styled

Sets the background color to Yellow.

source

fn underline_yellow(self) -> Self::Styled

Sets the underline color to Yellow.

source

fn dark_yellow(self) -> Self::Styled

Sets the foreground color to DarkYellow.

source

fn on_dark_yellow(self) -> Self::Styled

Sets the background color to DarkYellow.

source

fn underline_dark_yellow(self) -> Self::Styled

Sets the underline color to DarkYellow.

source

fn blue(self) -> Self::Styled

Sets the foreground color to Blue.

source

fn on_blue(self) -> Self::Styled

Sets the background color to Blue.

source

fn underline_blue(self) -> Self::Styled

Sets the underline color to Blue.

source

fn dark_blue(self) -> Self::Styled

Sets the foreground color to DarkBlue.

source

fn on_dark_blue(self) -> Self::Styled

Sets the background color to DarkBlue.

source

fn underline_dark_blue(self) -> Self::Styled

Sets the underline color to DarkBlue.

source

fn magenta(self) -> Self::Styled

Sets the foreground color to Magenta.

source

fn on_magenta(self) -> Self::Styled

Sets the background color to Magenta.

source

fn underline_magenta(self) -> Self::Styled

Sets the underline color to Magenta.

source

fn dark_magenta(self) -> Self::Styled

Sets the foreground color to DarkMagenta.

source

fn on_dark_magenta(self) -> Self::Styled

Sets the background color to DarkMagenta.

source

fn underline_dark_magenta(self) -> Self::Styled

Sets the underline color to DarkMagenta.

source

fn cyan(self) -> Self::Styled

Sets the foreground color to Cyan.

source

fn on_cyan(self) -> Self::Styled

Sets the background color to Cyan.

source

fn underline_cyan(self) -> Self::Styled

Sets the underline color to Cyan.

source

fn dark_cyan(self) -> Self::Styled

Sets the foreground color to DarkCyan.

source

fn on_dark_cyan(self) -> Self::Styled

Sets the background color to DarkCyan.

source

fn underline_dark_cyan(self) -> Self::Styled

Sets the underline color to DarkCyan.

source

fn white(self) -> Self::Styled

Sets the foreground color to White.

source

fn on_white(self) -> Self::Styled

Sets the background color to White.

source

fn underline_white(self) -> Self::Styled

Sets the underline color to White.

source

fn grey(self) -> Self::Styled

Sets the foreground color to Grey.

source

fn on_grey(self) -> Self::Styled

Sets the background color to Grey.

source

fn underline_grey(self) -> Self::Styled

Sets the underline color to Grey.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Stylize for &str

§

type Styled = StyledContent<&str>

source§

fn stylize(self) -> Self::Styled

source§

impl Stylize for char

source§

impl Stylize for String

Implementors§