Enum term_painter::Color
[−]
[src]
pub enum Color { NotSet, Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, BrightBlack, BrightRed, BrightGreen, BrightYellow, BrightBlue, BrightMagenta, BrightCyan, BrightWhite, Custom(u16), }
Lists all possible Colors. It implements ToStyle
so it's possible to call
ToStyle
's methods directly on a Color
variant like:
println!("{}", Color::Red.bold().paint("Red and bold"));
It is not guaranteed that the local terminal supports all of those colors.
As already mentioned in the module documentation, you should use term
directly to check the terminal's capabilities.
Note: Using Color::NotSet
will not reset the color to the default
terminal color.
Variants
NotSet
Black
Red
Green
Yellow
Blue
Magenta
Cyan
White
BrightBlack
BrightRed
BrightGreen
BrightYellow
BrightBlue
BrightMagenta
BrightCyan
BrightWhite
Custom(u16)
Trait Implementations
impl Debug for Color
[src]
impl Copy for Color
[src]
impl Clone for Color
[src]
fn clone(&self) -> Color
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for Color
[src]
fn eq(&self, __arg_0: &Color) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Color) -> bool
This method tests for !=
.
impl Eq for Color
[src]
impl Default for Color
[src]
impl ToStyle for Color
[src]
fn to_style(self) -> Style
Returns a Style with default values and the self
color as foreground
color.
fn to_mapped_style<F>(self, func: F) -> Style where
F: FnOnce(&mut Style),
F: FnOnce(&mut Style),
Convenience method for modifying the style before it's returned.
fn fg(self, c: Color) -> Style
Sets the foreground (text) color.
fn bg(self, c: Color) -> Style
Sets the background color.
fn bold(self) -> Style
Makes the text bold.
fn dim(self) -> Style
Dim mode.
fn underline(self) -> Style
Underlines the text.
fn not_underline(self) -> Style
Removes underline-attribute.
fn blink(self) -> Style
Underlines the text.
fn reverse(self) -> Style
Underlines the text.
fn secure(self) -> Style
Secure mode.
fn paint<T>(&self, obj: T) -> Painted<T> where
Self: Clone,
Self: Clone,
Wraps the style specified in self
and something of arbitrary type into a Painted
. When Painted
is printed it will print the arbitrary something with the given style. Read more
fn with<F, R>(&self, f: F) -> R where
F: FnOnce() -> R,
Self: Clone,
F: FnOnce() -> R,
Self: Clone,
Executes the given function, applying the style information before calling it and resetting after it finished. Read more