pub enum Color {
TerminalDefault,
Dark(BaseColor),
Light(BaseColor),
Rgb(u8, u8, u8),
RgbLowRes(u8, u8, u8),
}
Expand description
Represents a color used by the theme.
Variants§
TerminalDefault
Represents a color, preset by terminal.
Dark(BaseColor)
One of the 8 base colors.
These colors should work on any terminal.
Note: the actual color used depends on the terminal configuration.
Light(BaseColor)
Lighter version of a base color.
The native linux TTY usually doesn’t support these colors, but almost all terminal emulators should.
Note: the actual color used depends on the terminal configuration.
Rgb(u8, u8, u8)
True-color, 24-bit.
On terminals that don’t support this, the color will be “downgraded” to the closest one available.
RgbLowRes(u8, u8, u8)
Low-resolution color.
Each value should be <= 5
(you’ll get panics otherwise).
These 216 possible colors are part of the terminal color palette (256 colors).
Implementations§
Source§impl Color
impl Color
Sourcepub const fn from_256colors(n: u8) -> Color
pub const fn from_256colors(n: u8) -> Color
Creates a color from its ID in the 256 colors list.
- Colors 0-7 are base dark colors.
- Colors 8-15 are base light colors.
- Colors 16-231 are rgb colors with 6 values per channel (216 colors).
- Colors 232-255 are grayscale colors.
Trait Implementations§
Source§impl From<Color> for ColorStyle
impl From<Color> for ColorStyle
Source§fn from(color: Color) -> ColorStyle
fn from(color: Color) -> ColorStyle
Converts to this type from the input type.
Source§impl Resolvable for Color
impl Resolvable for Color
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
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.