pub enum Color {
Default,
Named(NamedColor),
Indexed(u8),
Rgb(u8, u8, u8),
}Expand description
Renderer-neutral color. The variants cover every shape any
terminal-or-GPU renderer ever needs: Default for “use the
terminal/window’s default”, Named for the 16 ANSI palette
names (TUI’s 16-color fallback path), Indexed for the
256-color palette, Rgb for 24-bit truecolor.
TUI renderer maps Rgb to Indexed-closest-match when the
terminal doesn’t support truecolor. GPUI ignores Named /
Indexed lookups in palette-aware mode and reads Rgb
directly. The host owns the lossless form; each renderer
owns its own lossy-mapping at adapter time.
Variants§
Default
Terminal / window default for this channel. Maps to
ratatui::Color::Reset.
Named(NamedColor)
One of the 16 named ANSI colors. The TUI’s primary palette path; GPUI maps these to its theme’s named-color table.
Indexed(u8)
256-color palette index (xterm 256-color extension).
Rgb(u8, u8, u8)
24-bit truecolor.
Implementations§
Source§impl Color
impl Color
Sourcepub fn to_rgb_u32(self, fallback: u32) -> u32
pub fn to_rgb_u32(self, fallback: u32) -> u32
Convert to a 24-bit 0xRRGGBB packed u32 for GPU-side
renderers (which want raw truecolor, not the renderer-
neutral Color enum). Color::Default returns
fallback — the caller decides what “use the terminal /
window default channel” means in pixel-space.
Named colors map to canonical ANSI RGB values that match what xterm + most modern terminal emulators use. The indexed (xterm 256) path computes the 6×6×6 cube + the 24-step grayscale ramp standardly.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
key and return true if they are equal.§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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more