Enum ansi_term::Style [] [src]

pub enum Style {
    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.



The Plain style provides no formatting.


The Foreground style provides just a foreground colour.


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.


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


impl Style

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

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

Formats the value using the given formatter.

impl Copy for Style

impl Clone for Style

fn clone(&self) -> Style

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl PartialEq for Style

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 !=.