#[non_exhaustive]pub struct ThemeColors {Show 20 fields
pub background: Hsla,
pub foreground: Hsla,
pub muted: Hsla,
pub scrollbar: Hsla,
pub surface: SurfaceColor,
pub surface_secondary: Hsla,
pub surface_tertiary: Hsla,
pub overlay: SurfaceColor,
pub segment: SurfaceColor,
pub default: RoleColor,
pub accent: RoleColor,
pub success: RoleColor,
pub warning: RoleColor,
pub danger: RoleColor,
pub field: FieldColors,
pub border: Hsla,
pub separator: Hsla,
pub focus: Hsla,
pub link: Hsla,
pub backdrop: Hsla,
}Expand description
All semantic tokens of one appearance.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.background: Hsla--background
foreground: Hsla--foreground
muted: Hsla--muted — de-emphasised body text and icons.
scrollbar: Hsla--scrollbar: var(--scrollbar-thumb)
surface: SurfaceColor--surface / --surface-foreground — non-floating components
(cards, accordions, disclosure groups).
surface_secondary: Hsla--surface-secondary
surface_tertiary: Hsla--surface-tertiary
overlay: SurfaceColor--overlay / --overlay-foreground — floating components
(tooltips, popovers, modals, menus).
segment: SurfaceColor--segment / --segment-foreground — selected segment of a
segmented control (tabs, toggle groups).
default: RoleColor--default — the neutral backbone of the system.
accent: RoleColor--accent — the brand color (v2 primary).
success: RoleColor--success
warning: RoleColor--warning
danger: RoleColor--danger
field: FieldColorsThe form-field colors (--field-*).
border: Hsla--border
separator: Hsla--separator
focus: Hsla--focus
link: Hsla--link
backdrop: Hsla--backdrop — the scrim behind modals and drawers.
Implementations§
Source§impl ThemeColors
impl ThemeColors
Sourcepub fn vibrant_palette(&self) -> bool
pub fn vibrant_palette(&self) -> bool
Whether [data-vibrant-palette="true"] is on (variables.css:317-330).
The flag lives on each RoleColor; the mixing roles are set together
by crate::ThemeBuilder::vibrant_palette, so accent answers for all.
Sourcepub fn set_vibrant_palette(&mut self, vibrant: bool)
pub fn set_vibrant_palette(&mut self, vibrant: bool)
Fans [data-vibrant-palette="true"] out over the roles the selector
lists: accent, success, warning and danger. default is absent from
both blocks upstream and keeps --default-soft-foreground.
Sourcepub fn background_secondary(&self) -> Hsla
pub fn background_secondary(&self) -> Hsla
color-mix(in oklab, var(--background) 96%, var(--foreground) 4%)
Sourcepub fn background_tertiary(&self) -> Hsla
pub fn background_tertiary(&self) -> Hsla
color-mix(in oklab, var(--background) 92%, var(--foreground) 8%)
Sourcepub fn background_inverse(&self) -> Hsla
pub fn background_inverse(&self) -> Hsla
--color-background-inverse: var(--foreground)
Sourcepub fn separator_secondary(&self) -> Hsla
pub fn separator_secondary(&self) -> Hsla
color-mix(in oklab, var(--surface) 85%, var(--surface-foreground) 15%)
Sourcepub fn separator_tertiary(&self) -> Hsla
pub fn separator_tertiary(&self) -> Hsla
color-mix(in oklab, var(--surface) 81%, var(--surface-foreground) 19%)
Sourcepub fn border_secondary(&self) -> Hsla
pub fn border_secondary(&self) -> Hsla
--border-secondary: color-mix(in oklab, var(--surface) 78%, var(--surface-foreground) 22%)
Sourcepub fn border_tertiary(&self) -> Hsla
pub fn border_tertiary(&self) -> Hsla
--border-tertiary: color-mix(in oklab, var(--surface) 66%, var(--surface-foreground) 34%)
Sourcepub fn surface_secondary_foreground(&self) -> Hsla
pub fn surface_secondary_foreground(&self) -> Hsla
--surface-secondary-foreground: var(--foreground)
v3 gives the secondary and tertiary surfaces their own foreground variables, both defaulting to the page’s, so a caller who repaints one of those surfaces has somewhere to put the matching text colour.
Sourcepub fn surface_tertiary_foreground(&self) -> Hsla
pub fn surface_tertiary_foreground(&self) -> Hsla
--surface-tertiary-foreground: var(--foreground)
Trait Implementations§
Source§impl Clone for ThemeColors
impl Clone for ThemeColors
Auto Trait Implementations§
impl Freeze for ThemeColors
impl RefUnwindSafe for ThemeColors
impl Send for ThemeColors
impl Sync for ThemeColors
impl Unpin for ThemeColors
impl UnsafeUnpin for ThemeColors
impl UnwindSafe for ThemeColors
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 more