Struct ColorSpec

struct ColorSpec { ... }

A color specification.

Implementations

impl ColorSpec

fn new() -> ColorSpec

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

fn fg(self: &Self) -> Option<&Color>

Get the foreground color.

fn set_fg(self: &mut Self, color: Option<Color>) -> &mut ColorSpec

Set the foreground color.

fn bg(self: &Self) -> Option<&Color>

Get the background color.

fn set_bg(self: &mut Self, color: Option<Color>) -> &mut ColorSpec

Set the background color.

fn bold(self: &Self) -> bool

Get whether this is bold or not.

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

fn set_bold(self: &mut Self, yes: bool) -> &mut ColorSpec

Set whether the text is bolded or not.

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

fn dimmed(self: &Self) -> bool

Get whether this is dimmed or not.

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

fn set_dimmed(self: &mut Self, yes: bool) -> &mut ColorSpec

Set whether the text is dimmed or not.

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

fn italic(self: &Self) -> bool

Get whether this is italic or not.

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

fn set_italic(self: &mut Self, yes: bool) -> &mut ColorSpec

Set whether the text is italicized or not.

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

fn underline(self: &Self) -> bool

Get whether this is underline or not.

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

fn set_underline(self: &mut Self, yes: bool) -> &mut ColorSpec

Set whether the text is underlined or not.

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

fn strikethrough(self: &Self) -> bool

Get whether this is strikethrough or not.

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

fn set_strikethrough(self: &mut Self, yes: bool) -> &mut ColorSpec

Set whether the text is strikethrough or not.

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

fn reset(self: &Self) -> bool

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.

fn set_reset(self: &mut Self, yes: bool) -> &mut ColorSpec

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.

fn intense(self: &Self) -> bool

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.

fn set_intense(self: &mut Self, yes: bool) -> &mut ColorSpec

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.

fn is_none(self: &Self) -> bool

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

fn clear(self: &mut Self)

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

impl Clone for ColorSpec

fn clone(self: &Self) -> ColorSpec

impl Debug for ColorSpec

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

impl Default for ColorSpec

fn default() -> ColorSpec

impl Eq for ColorSpec

impl Freeze for ColorSpec

impl PartialEq for ColorSpec

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

impl RefUnwindSafe for ColorSpec

impl Send for ColorSpec

impl StructuralPartialEq for ColorSpec

impl Sync for ColorSpec

impl Unpin for ColorSpec

impl UnwindSafe for ColorSpec

impl<T> Any for ColorSpec

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for ColorSpec

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for ColorSpec

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

impl<T> CloneToUninit for ColorSpec

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for ColorSpec

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for ColorSpec

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for ColorSpec

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for ColorSpec

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

impl<T, U> TryInto for ColorSpec

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