pub struct Palette { /* private fields */ }Expand description
Opaque normalized sRGB in ColorRole::ALL order. Private storage preserves
channel/alpha validation. A palette alone has no contrast policy;
UiTheme::try_new checks required pairs before adoption.
Implementations§
Source§impl Palette
impl Palette
Sourcepub fn try_new_srgb(colors: [Color; 11]) -> Result<Palette, ThemeError>
pub fn try_new_srgb(colors: [Color; 11]) -> Result<Palette, ThemeError>
Author a full palette without silently converting/clipping channels.
use ferravex_play::ui::theme::*;
let base = UiTheme::preset(ThemeMode::Normal);
let colors = ColorRole::ALL.map(|r| base.color(r));
let palette = Palette::try_new_srgb(colors)?;
let custom = UiTheme::try_new(base.mode(), base.types(), base.spacing(), palette)?;
assert_eq!(custom, base);pub fn color(self, role: ColorRole) -> Color
Trait Implementations§
impl Copy 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 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