pub struct ContentStyle {
    pub foreground_color: Option<Color>,
    pub background_color: Option<Color>,
    pub underline_color: Option<Color>,
    pub attributes: Attributes,
}
Expand description

The style that can be put on content.

Fields§

§foreground_color: Option<Color>

The foreground color.

§background_color: Option<Color>

The background color.

§underline_color: Option<Color>

The underline color.

§attributes: Attributes

List of attributes.

Implementations§

source§

impl ContentStyle

source

pub fn apply<D: Display>(self, val: D) -> StyledContent<D>

Creates a StyledContent by applying the style to the given val.

source

pub fn new() -> ContentStyle

Creates a new ContentStyle.

Trait Implementations§

source§

impl AsMut<ContentStyle> for ContentStyle

source§

fn as_mut(&mut self) -> &mut Self

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<D: Display> AsMut<ContentStyle> for StyledContent<D>

source§

fn as_mut(&mut self) -> &mut ContentStyle

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<ContentStyle> for ContentStyle

source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<D: Display> AsRef<ContentStyle> for StyledContent<D>

source§

fn as_ref(&self) -> &ContentStyle

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for ContentStyle

source§

fn clone(&self) -> ContentStyle

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ContentStyle

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ContentStyle

source§

fn default() -> ContentStyle

Returns the “default value” for a type. Read more
source§

impl PartialEq<ContentStyle> for ContentStyle

source§

fn eq(&self, other: &ContentStyle) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Stylize for ContentStyle

§

type Styled = ContentStyle

This type with styles applied.
source§

fn stylize(self) -> Self::Styled

Styles this type.
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.
source§

impl Copy for ContentStyle

source§

impl Eq for ContentStyle

source§

impl StructuralEq for ContentStyle

source§

impl StructuralPartialEq for ContentStyle

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.