pub enum ColorDef {
Named(Color),
Color256(u8),
Rgb(u8, u8, u8),
}Expand description
Parsed color definition from stylesheet.
Variants§
Named(Color)
Named ANSI color.
Color256(u8)
256-color palette index.
Rgb(u8, u8, u8)
True color RGB.
Implementations§
Source§impl ColorDef
impl ColorDef
Sourcepub fn parse_value(value: &Value) -> Result<Self, String>
pub fn parse_value(value: &Value) -> Result<Self, String>
Parses a color definition from a YAML value.
Supports:
- Strings: named colors, bright variants, hex codes
- Numbers: 256-color palette indices
- Sequences: RGB tuples
[r, g, b]
Sourcepub fn parse_string(s: &str) -> Result<Self, String>
pub fn parse_string(s: &str) -> Result<Self, String>
Parses a color from a string value.
Supports:
- Named colors:
red,green,blue, etc. - Bright variants:
bright_red,bright_green, etc. - Hex codes:
#ff6b35or#fff
Sourcepub fn to_console_color(&self) -> Color
pub fn to_console_color(&self) -> Color
Converts this color definition to a console::Color.
Trait Implementations§
impl Eq for ColorDef
impl StructuralPartialEq for ColorDef
Auto Trait Implementations§
impl Freeze for ColorDef
impl RefUnwindSafe for ColorDef
impl Send for ColorDef
impl Sync for ColorDef
impl Unpin for ColorDef
impl UnwindSafe for ColorDef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.