[][src]Struct termcolor::ColorSpec

pub struct ColorSpec { /* fields omitted */ }

A color specification.

Methods

impl ColorSpec[src]

pub fn new() -> ColorSpec[src]

Create a new color specification that has no colors or styles.

pub fn fg(&self) -> Option<&Color>[src]

Get the foreground color.

pub fn set_fg(&mut self, color: Option<Color>) -> &mut ColorSpec[src]

Set the foreground color.

pub fn bg(&self) -> Option<&Color>[src]

Get the background color.

pub fn set_bg(&mut self, color: Option<Color>) -> &mut ColorSpec[src]

Set the background color.

pub fn bold(&self) -> bool[src]

Get whether this is bold or not.

Note that the bold setting has no effect in a Windows console.

pub fn set_bold(&mut self, yes: bool) -> &mut ColorSpec[src]

Set whether the text is bolded or not.

Note that the bold setting has no effect in a Windows console.

pub fn italic(&self) -> bool[src]

Get whether this is italic or not.

Note that the italic setting has no effect in a Windows console.

pub fn set_italic(&mut self, yes: bool) -> &mut ColorSpec[src]

Set whether the text is italicized or not.

Note that the italic setting has no effect in a Windows console.

pub fn underline(&self) -> bool[src]

Get whether this is underline or not.

Note that the underline setting has no effect in a Windows console.

pub fn set_underline(&mut self, yes: bool) -> &mut ColorSpec[src]

Set whether the text is underlined or not.

Note that the underline setting has no effect in a Windows console.

pub fn reset(&self) -> bool[src]

Get whether reset is enabled or not.

reset is enabled by default. When disabled and using ANSI escape sequences, a "reset" code will be emitted every time a ColorSpec's settings are applied.

Note that the reset setting has no effect in a Windows console.

pub fn set_reset(&mut self, yes: bool) -> &mut ColorSpec[src]

Set whether to reset the terminal whenever color settings are applied.

reset is enabled by default. When disabled and using ANSI escape sequences, a "reset" code will be emitted every time a ColorSpec's settings are applied.

Typically this is useful if callers have a requirement to more scrupulously manage the exact sequence of escape codes that are emitted when using ANSI for colors.

Note that the reset setting has no effect in a Windows console.

pub fn intense(&self) -> bool[src]

Get whether this is intense or not.

On Unix-like systems, this will output the ANSI escape sequence that will print a high-intensity version of the color specified.

On Windows systems, this will output the ANSI escape sequence that will print a brighter version of the color specified.

pub fn set_intense(&mut self, yes: bool) -> &mut ColorSpec[src]

Set whether the text is intense or not.

On Unix-like systems, this will output the ANSI escape sequence that will print a high-intensity version of the color specified.

On Windows systems, this will output the ANSI escape sequence that will print a brighter version of the color specified.

pub fn is_none(&self) -> bool[src]

Returns true if this color specification has no colors or styles.

pub fn clear(&mut self)[src]

Clears this color specification so that it has no color/style settings.

Trait Implementations

impl Clone for ColorSpec[src]

impl Debug for ColorSpec[src]

impl Default for ColorSpec[src]

impl Eq for ColorSpec[src]

impl PartialEq<ColorSpec> for ColorSpec[src]

impl StructuralEq for ColorSpec[src]

impl StructuralPartialEq for ColorSpec[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.