pub struct Theme {Show 15 fields
pub id: SharedString,
pub name: SharedString,
pub appearance: Appearance,
pub density: Density,
pub colors: Colors,
pub typography: Typography,
pub spacing: Spacing,
pub radii: Radii,
pub control: Control,
pub borders: Borders,
pub opacity: Opacity,
pub motion: Motion,
pub elevation: Elevations,
pub z_index: ZIndices,
pub effects: Effects,
}Fields§
§id: SharedString§name: SharedString§appearance: Appearance§density: Density§colors: Colors§typography: Typography§spacing: Spacing§radii: Radii§control: Control§borders: Borders§opacity: Opacity§motion: Motion§elevation: Elevations§z_index: ZIndices§effects: EffectsImplementations§
Source§impl Theme
impl Theme
pub fn studio_dark() -> Self
pub fn studio_light() -> Self
Sourcepub fn from_tokens(tokens: &TokenDocument, density: Density) -> Self
pub fn from_tokens(tokens: &TokenDocument, density: Density) -> Self
Builds a theme from any validated token document at one density.
Density scales spacing, control geometry and type independently, and rounds to whole pixels so compact layouts stay on the pixel grid.
pub fn surface(&self, surface: Surface) -> Hsla
pub fn text_color(&self, tone: TextTone) -> Hsla
pub fn semantic_color(&self, color: SemanticColor) -> Hsla
pub fn space(&self, step: Space) -> f32
pub fn radius(&self, step: Radius) -> f32
pub fn type_style(&self, scale: TypeScale) -> TypeStyle
pub fn easing(&self, easing: MotionEasing) -> [f32; 4]
pub fn spring(&self, preset: SpringPreset) -> SpringTokens
pub fn shadow(&self, level: Elevation) -> &[BoxShadow]
pub fn layer(&self, layer: Layer) -> i32
pub fn get(cx: &App) -> &Self
Sourcepub fn focus_ring(&self) -> Vec<BoxShadow>
pub fn focus_ring(&self) -> Vec<BoxShadow>
The ring drawn around whichever control currently has the keyboard.
It spreads outward in the focus colour, so it reads differently from
Self::selected_ring: focus says where the next keystroke goes,
selection says which answer is current, and a reader that cannot tell
the two apart cannot tell what pressing a key would do.
pub fn selected_ring(&self) -> Vec<BoxShadow>
Sourcepub fn glow(&self, color: Hsla) -> Vec<BoxShadow>
pub fn glow(&self, color: Hsla) -> Vec<BoxShadow>
The colour a surface in a named state bleeds into the pixels around it.
It is the state itself made visible at the edge, which is what lets a surface report “running” or “failed” without a border drawn round it. Blurred and unoffset, so nothing about it reads as a line.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
impl UnwindSafe for Theme
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().