pub struct Palette { /* private fields */ }Expand description
A named set of base colors. StyleSpec colors reference these by
key; resolution looks them up here.
Implementations§
Source§impl Palette
impl Palette
pub fn new() -> Self
Sourcepub fn with(self, key: impl Into<PaletteKey>, color: Color) -> Self
pub fn with(self, key: impl Into<PaletteKey>, color: Color) -> Self
Builder-style insert.
pub fn insert(&mut self, key: impl Into<PaletteKey>, color: Color)
Sourcepub fn get(&self, key: &PaletteKey) -> Option<Color>
pub fn get(&self, key: &PaletteKey) -> Option<Color>
Look up a color by key. None if the active palette lacks it
— resolution then falls back (inherit chain → hard default)
and logs once rather than panicking.
Sourcepub fn keys(&self) -> impl Iterator<Item = &PaletteKey>
pub fn keys(&self) -> impl Iterator<Item = &PaletteKey>
Iterate over every key this palette defines. Used by the
completeness test to assert each builtin theme covers the full
role-key set default_palette defines (no resolution fallback).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
impl Eq for Palette
impl StructuralPartialEq for Palette
Auto Trait Implementations§
impl Freeze for Palette
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnsafeUnpin for Palette
impl UnwindSafe for Palette
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