Struct ThemeDocument
pub struct ThemeDocument {
pub schema_version: u32,
pub id: String,
pub name: String,
pub palette: Palette,
pub emphasis: Emphasis,
pub presence: Tone,
pub shape: ThemeShape,
pub density: ThemeDensity,
pub type_: ThemeType,
pub motion: ThemeMotion,
pub material: ThemeMaterial,
}Expand description
A theme, as data. See the module documentation.
Fields§
§schema_version: u32§id: String§name: String§palette: Palette§emphasis: Emphasis§presence: ToneLightness and chroma of the twelve presence colours.
shape: ThemeShape§density: ThemeDensity§type_: ThemeType§motion: ThemeMotion§material: ThemeMaterialImplementations§
§impl ThemeDocument
impl ThemeDocument
pub fn stock(id: &str, name: &str, palette: Palette) -> ThemeDocument
pub fn stock(id: &str, name: &str, palette: Palette) -> ThemeDocument
A document with the stock roles around palette.
pub fn validate(&self) -> Result<(), &'static str>
pub fn validate(&self) -> Result<(), &'static str>
Structural check: the schema, the text fields, and every number
finite and inside the band its role admits. A document that fails is
not a theme. Legibility is Self::findings.
§Errors
A static message naming the first field that is out of range.
pub fn findings(&self) -> Vec<ContrastFinding>
pub fn findings(&self) -> Vec<ContrastFinding>
Every contrast floor this document misses as authored, whoever wears it (each presence hue as the focus ring), worst ratio first per pair. Theme Studio refuses to save a document with findings; the runtime repairs one that arrives anyway.
pub fn in_high_contrast(&self) -> ThemeDocument
pub fn in_high_contrast(&self) -> ThemeDocument
The same document as the high-contrast palette of its polarity: shape, density, type and motion stay; the palette, presence tone and emphasis become the AAA ones and the material turns opaque.
Trait Implementations§
§impl Clone for ThemeDocument
impl Clone for ThemeDocument
§fn clone(&self) -> ThemeDocument
fn clone(&self) -> ThemeDocument
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ThemeDocument
impl Debug for ThemeDocument
§impl<'de> Deserialize<'de> for ThemeDocument
impl<'de> Deserialize<'de> for ThemeDocument
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ThemeDocument, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ThemeDocument, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl PartialEq for ThemeDocument
impl PartialEq for ThemeDocument
§impl Serialize for ThemeDocument
impl Serialize for ThemeDocument
§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 StructuralPartialEq for ThemeDocument
Auto Trait Implementations§
impl Freeze for ThemeDocument
impl RefUnwindSafe for ThemeDocument
impl Send for ThemeDocument
impl Sync for ThemeDocument
impl Unpin for ThemeDocument
impl UnsafeUnpin for ThemeDocument
impl UnwindSafe for ThemeDocument
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