#[non_exhaustive]pub enum Color {
Default,
Ansi(u8),
Rgb(u8, u8, u8),
}Expand description
A terminal color, which can be applied to the foreground or background.
Note that some distinct values of Color could end up appearing as the
same color when displayed in the terminal. However, the PartialEq
implementation does not account for this; it only compares the
representation of the enum.
From implementations are provided for convenience.
§Example
use line_ui::Color;
assert_eq!(Color::Default, Color::default());
assert_eq!(Color::Ansi(42), 42.into());
assert_eq!(Color::Rgb(20, 40, 90), (20, 40, 90).into());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Default
The default color used by the terminal.
Ansi(u8)
An ANSI color code.
Rgb(u8, u8, u8)
An RGB color.
Implementations§
Source§impl Color
impl Color
pub const BLACK: Color
pub const RED: Color
pub const GREEN: Color
pub const YELLOW: Color
pub const BLUE: Color
pub const MAGENTA: Color
pub const CYAN: Color
pub const WHITE: Color
pub const LIGHT_BLACK: Color
pub const LIGHT_RED: Color
pub const LIGHT_GREEN: Color
pub const LIGHT_YELLOW: Color
pub const LIGHT_BLUE: Color
pub const LIGHT_MAGENTA: Color
pub const LIGHT_CYAN: Color
pub const LIGHT_WHITE: Color
Trait Implementations§
impl Copy for Color
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more