pub enum Color {
Default,
Bios(u8),
Indexed(u8),
Rgb(u8, u8, u8),
}Expand description
A desired foreground or background colour.
In a terminal, Color::Default is the colour of text with no display
attributes set — so a default/default cell still produces visible text.
§Turbo Vision heritage
Faithful to TColorDesired’s four-variant design (colors.h), minus the
bit-packing.
Variants§
Default
Terminal default (ctDefault).
Bios(u8)
4-bit BIOS colour (ctBIOS / TColorBIOS). Invariant: 0..=15. C++
masks bios & 0xF on construction; we store the raw u8, so callers and
the quantization ladder must mask to keep a 16-entry palette lookup in
range.
Indexed(u8)
Index into the xterm-256 palette, 0..=255 (ctXTerm / TColorXTerm).
Rgb(u8, u8, u8)
24-bit true colour (ctRGB / TColorRGB).
Implementations§
Source§impl Color
impl Color
Sourcepub const BIOS_RGB: [(u8, u8, u8); 16]
pub const BIOS_RGB: [(u8, u8, u8); 16]
Canonical IBM VGA text-mode RGB for each of the 16 BIOS palette indices.
Single source of truth for resolving Color::Bios(n) to a definite
true-color value (used by the default theme and the colour picker).
Sourcepub fn bios_rgb(index: u8) -> Color
pub fn bios_rgb(index: u8) -> Color
Resolve a 4-bit BIOS index to its canonical true-color RGB. The index is masked to 0..=15.
pub fn is_default(self) -> bool
pub fn is_bios(self) -> bool
pub fn is_indexed(self) -> bool
pub fn is_rgb(self) -> bool
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.