Struct Palette
pub struct Palette {
pub dark: bool,
pub high_contrast: bool,
pub hue: Option<f32>,
pub chroma: f32,
pub surfaces: SurfaceLadder,
pub ink: InkLadder,
pub status: StatusTones,
}Expand description
The neutral material and its inks.
Fields§
§dark: boolInk is light on these surfaces.
high_contrast: boolEvery text pairing holds WCAG AAA, floating chrome is opaque, and content surfaces are asked to force their colours.
hue: Option<f32>The OKLCH hue every neutral shares, in degrees. None until
something gives the material a temperature: a palette without a hue
renders pure grey whatever its chroma, and the workspace it is shown
in supplies one (Theme::with_neutral_hue).
chroma: f32The neutrals’ chroma, 0 (pure grey) to NEUTRAL_MAX_CHROMA: how
much temperature the material takes once it has a hue. At 0 a
workspace’s temperature has nothing to tint.
surfaces: SurfaceLadder§ink: InkLadder§status: StatusTonesImplementations§
§impl Palette
impl Palette
pub const fn dark_graphite() -> Palette
pub const fn dark_graphite() -> Palette
The dark ladder, warm graphite.
pub const fn dark_soft() -> Palette
pub const fn dark_soft() -> Palette
A lifted dark ladder, faintly violet: lower contrast between ground and ink for long sessions. The tertiary tier rises with the surfaces so it still reads as body text on content.
pub const fn light() -> Palette
pub const fn light() -> Palette
The light ladder. It has no hue of its own: pure grey until the workspace it is shown in gives it a temperature, which its chroma then carries.
pub const fn high_contrast_dark() -> Palette
pub const fn high_contrast_dark() -> Palette
Black ground under near-white ink: every text pairing at WCAG AAA.
pub const fn high_contrast_light() -> Palette
pub const fn high_contrast_light() -> Palette
White ground under black ink: every text pairing at WCAG AAA.
pub fn temperature(&self) -> (f32, f32)
pub fn temperature(&self) -> (f32, f32)
The hue and chroma the neutrals are painted at: the palette’s own when it has a hue, pure grey (chroma 0) until it has one.
pub const fn stock_presence(&self) -> Tone
pub const fn stock_presence(&self) -> Tone
The presence tone this polarity ships with.
pub fn validate(&self) -> Result<(), &'static str>
pub fn validate(&self) -> Result<(), &'static str>
Structural check: finite numbers in range and a ladder whose ink sits
on the right side of every surface. Legibility is checked on the
materialized colours (crate::tokens::contrast::audit).
§Errors
A static message naming the first field out of range.
Trait Implementations§
§impl<'de> Deserialize<'de> for Palette
impl<'de> Deserialize<'de> for Palette
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Palette, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Palette, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for Palette
impl Serialize for Palette
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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 UnsafeUnpin for Palette
impl UnwindSafe for Palette
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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