Enum better_term::Color
source · [−]pub enum Color {
}
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)
RGB(u8, u8, u8)
Hex(u32)
Default
Implementations
sourceimpl Color
impl Color
sourcepub fn to_style_fg(self) -> Style
pub fn to_style_fg(self) -> Style
Convert color to a style with the foreground set to this color
sourcepub fn to_style_bg(self) -> Style
pub fn to_style_bg(self) -> Style
Convert color to a style with the background set to this color
sourcepub fn hex_to_rgb(hex: u32) -> Color
pub fn hex_to_rgb(hex: u32) -> Color
convert a hexadecimal value to an RGB color value (hex example: 0x000000 for black)
Trait Implementations
sourceimpl PartialEq<Color> for Color
impl PartialEq<Color> for Color
impl Copy for Color
impl StructuralPartialEq for Color
Auto Trait Implementations
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more