pub struct ColorSpec { /* private fields */ }
Expand description

A color specification.

Implementations

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

Get the foreground color.

Set the foreground color.

Get the background color.

Set the background color.

Get whether this is bold or not.

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

Set whether the text is bolded or not.

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

Get whether this is dimmed or not.

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

Set whether the text is dimmed or not.

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

Get whether this is italic or not.

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

Set whether the text is italicized or not.

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

Get whether this is underline or not.

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

Set whether the text is underlined or not.

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

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.

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.

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.

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.

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

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.