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

A way to style output, by setting flags within this struct and then outputting it with (“… {} …”, style)

Example

use better_term::Style;

// prints out Hello world! underlined and bold
let style = Style::default().underline().bold();

println!("{}Hello, world!", style);

Implementations

Creates a new Style with default values

Resets all styles and makes a new style

sets the foreground

clears the foreground

sets a new background

clear the background

this will overwrite previous styles with default values

Set the output to bold

Set the output to be dim

Set the output to be italic

Set the output to be underlined

Set the output to blink This is not supported in most terminals

Inverts the current colors (bg and fg) through ansi (does not change fg and bg values)

hides the text (it’s still there, just hidden.)

sets the text to be strike-through

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Get the default values for a Style This will not overwrite anything other than what is set by previous styles

Formats the value using the given formatter. Read more

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

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

Converts the given value to a String. 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.