pub struct AnsiPalette {
pub colors: [ElementId; 16],
pub bold: ElementId,
}Expand description
The interned theme elements CM.5 paints ANSI output with.
Copy so the pipe readers can each hold one without sharing state
— the ids are process-stable once registered.
Fields§
§colors: [ElementId; 16]Indexed by 4-bit ANSI slot (see [ANSI_NAMES]).
bold: ElementIdBold with no colour attached.
Implementations§
Source§impl AnsiPalette
impl AnsiPalette
Sourcepub fn register(registry: &dyn ThemeRegistry) -> Self
pub fn register(registry: &dyn ThemeRegistry) -> Self
Register compilation.ansi.* and intern the ids. Idempotent —
[ThemeRegistry::register] returns the existing id for a name
already present, so a second boot (or a second install in a
test) does not duplicate elements.
The defaults are [ColorRef::Literal] rather than palette
references on purpose. The ansi.* palette family exists
already, but every one of the 21 builtin palettes defines its
entries as the same Color::Named(..) pass-through — they are
terminal channels, not palette-specific accents, so a per-theme
key would be 21 identical copies of one value. A theme that
genuinely wants to retune them (a light theme where the
terminal’s red is unreadable) overrides them by element
name through the T.9 override path, which needs no palette
key. Promoting these to a core ansi.* element family is the
upgrade path if a second consumer (terminal, agent output)
appears.
Trait Implementations§
Source§impl Clone for AnsiPalette
impl Clone for AnsiPalette
Source§fn clone(&self) -> AnsiPalette
fn clone(&self) -> AnsiPalette
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AnsiPalette
Source§impl Debug for AnsiPalette
impl Debug for AnsiPalette
impl Eq for AnsiPalette
Source§impl PartialEq for AnsiPalette
impl PartialEq for AnsiPalette
impl StructuralPartialEq for AnsiPalette
Auto Trait Implementations§
impl Freeze for AnsiPalette
impl RefUnwindSafe for AnsiPalette
impl Send for AnsiPalette
impl Sync for AnsiPalette
impl Unpin for AnsiPalette
impl UnsafeUnpin for AnsiPalette
impl UnwindSafe for AnsiPalette
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<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.