Enum ansi_term::Style [] [src]

pub enum Style {
    Plain,
    Foreground(Colour),
    Styled {
        foreground: Option<Colour>,
        background: Option<Colour>,
        bold: bool,
        underline: bool,
    },
}

A style is a collection of properties that can format a string using ANSI escape codes.

Variants

Plain

The Plain style provides no formatting.

Foreground(Colour)

The Foreground style provides just a foreground colour.

Styled

The Styled style is a catch-all for anything more complicated than that. It's technically possible for there to be other cases, such as "bold foreground", but probably isn't worth it.

Fields

foreground: Option<Colour>
background: Option<Colour>
bold: bool
underline: bool

Methods

impl Style
[src]

fn paint(self, input: &str) -> ANSIString

Paints the given text with this colour, returning an ANSI string.

fn bold(self) -> Style

Returns a Style with the bold property set.

fn underline(self) -> Style

Returns a Style with the underline property set.

fn on(self, background: Colour) -> Style

Returns a Style with the background colour property set.

Trait Implementations

impl Debug for Style
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Copy for Style
[src]

impl Clone for Style
[src]

fn clone(&self) -> Style

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl PartialEq for Style
[src]

fn eq(&self, __arg_0: &Style) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Style) -> bool

This method tests for !=.