Skip to main content

Theme

Struct Theme 

Source
pub struct Theme<'a, C: PixelColor> {
Show 16 fields pub background: Container<C>, pub primary: Container<C>, pub secondary: Container<C>, pub button: Component<C>, pub accent: Component<C>, pub destructive: Component<C>, pub success: Component<C>, pub warning: Component<C>, pub text_button: Component<C>, pub icon_button: Component<C>, pub palette: Palette<C>, pub spacing: Spacing, pub corner_radii: CornerRadii, pub typography: Typography<'a>, pub is_dark: bool, pub is_high_contrast: bool,
}
Expand description

Top-level theme. The application owns one and passes it down to widgets at draw time.

Widgets do not reach into the per-role component fields directly — they go through the catalog traits (ButtonCatalog, etc.), so changing the palette doesn’t ripple through every widget implementation.

Fields§

§background: Container<C>

Background region (the outermost layer behind everything).

§primary: Container<C>

Primary content region.

§secondary: Container<C>

Secondary panel/sidebar region.

§button: Component<C>

Standard button.

§accent: Component<C>

Accent / suggested-action.

§destructive: Component<C>

Destructive (red).

§success: Component<C>

Success (green).

§warning: Component<C>

Warning (yellow/orange).

§text_button: Component<C>

Text-only / ghost button.

§icon_button: Component<C>

Icon-only button.

§palette: Palette<C>

Named palette colors the rest of the theme is derived from.

§spacing: Spacing

Spacing scale.

§corner_radii: CornerRadii

Corner-radius scale.

§typography: Typography<'a>

Four-role mono font scale (display / heading / body / caption).

§is_dark: bool

Whether this is a dark theme.

§is_high_contrast: bool

Whether this is a high-contrast theme.

Implementations§

Source§

impl<'a, C: PixelColor> Theme<'a, C>

Source

pub fn default_font(&self) -> &'a MonoFont<'a>

Body font shortcut — what most widgets default to.

Trait Implementations§

Source§

impl<'a, C: PixelColor> ButtonCatalog<C> for Theme<'a, C>

Source§

fn button(&self, class: ButtonClass, status: Status) -> ButtonAppearance<C>

Resolve (class, status) to the colors the widget should paint.
Source§

impl<'a, C: Clone + PixelColor> Clone for Theme<'a, C>

Source§

fn clone(&self) -> Theme<'a, C>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, C: Debug + PixelColor> Debug for Theme<'a, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, C: PartialEq + PixelColor> PartialEq for Theme<'a, C>

Source§

fn eq(&self, other: &Theme<'a, C>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, C: Copy + PixelColor> Copy for Theme<'a, C>

Source§

impl<'a, C: PixelColor> StructuralPartialEq for Theme<'a, C>

Auto Trait Implementations§

§

impl<'a, C> Freeze for Theme<'a, C>
where C: Freeze,

§

impl<'a, C> !RefUnwindSafe for Theme<'a, C>

§

impl<'a, C> Send for Theme<'a, C>
where C: Send,

§

impl<'a, C> Sync for Theme<'a, C>
where C: Sync,

§

impl<'a, C> Unpin for Theme<'a, C>
where C: Unpin,

§

impl<'a, C> UnsafeUnpin for Theme<'a, C>
where C: UnsafeUnpin,

§

impl<'a, C> !UnwindSafe for Theme<'a, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.