Enum better_term::Color[][src]

pub enum Color {
Show 19 variants Black, Red, Green, Yellow, Blue, Purple, Cyan, White, BrightBlack, BrightRed, BrightGreen, BrightYellow, BrightBlue, BrightPurple, BrightCyan, BrightWhite, Fixed(u8), RGB(u8u8u8), Hex(u32),
}
Expand description

Default ansi colors

Example

use better_term::Color;

// prints Hello, world! in green and red
println!("{}Hello, {}world!", Color::BrightGreen, Color::BrightRed);

Variants

Black
Red
Green
Yellow
Blue
Purple
Cyan
White
BrightBlack
BrightRed
BrightGreen
BrightYellow
BrightBlue
BrightPurple
BrightCyan
BrightWhite
Fixed(u8)

Tuple Fields of Fixed

0: u8
RGB(u8u8u8)

Tuple Fields of RGB

0: u81: u82: u8
Hex(u32)

Tuple Fields of Hex

0: u32

Implementations

Convert color to a style with the foreground set to this color

Convert color to a style with the background set to this color

convert a hexadecimal value to an RGB color value (hex example: 0x000000 for black)

Convert to the ansi value within a string (for output with the ansi char)

Convert to the ansi value within a string (for output with the ansi char

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

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

Performs the conversion.

Performs the conversion.

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)

recently added

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.