Skip to main content

Theme

Struct Theme 

Source
pub struct Theme {
Show 14 fields pub name: String, pub primary: (u8, u8, u8), pub secondary: (u8, u8, u8), pub accent: (u8, u8, u8), pub surface: (u8, u8, u8), pub panel: (u8, u8, u8), pub background: (u8, u8, u8), pub foreground: (u8, u8, u8), pub success: (u8, u8, u8), pub warning: (u8, u8, u8), pub error: (u8, u8, u8), pub dark: bool, pub luminosity_spread: f64, pub variables: HashMap<String, TcssColor>,
}
Expand description

A semantic theme with named color slots and shade generation.

Colors are stored as (u8, u8, u8) RGB tuples. The resolve method maps variable names like "primary", "primary-lighten-2", or "accent-darken-1" to concrete TcssColor::Rgb values.

Fields§

§name: String

The unique identifier name for this theme (e.g., “textual-dark”).

§primary: (u8, u8, u8)

Primary brand color used for accented interactive elements.

§secondary: (u8, u8, u8)

Secondary brand color for supporting UI elements.

§accent: (u8, u8, u8)

Accent color for highlights and call-to-action elements.

§surface: (u8, u8, u8)

Surface color for widget backgrounds.

§panel: (u8, u8, u8)

Panel color for sidebars and container backgrounds.

§background: (u8, u8, u8)

Main application background color.

§foreground: (u8, u8, u8)

Default text foreground color.

§success: (u8, u8, u8)

Color for success/positive state indicators.

§warning: (u8, u8, u8)

Color for warning/caution state indicators.

§error: (u8, u8, u8)

Color for error/danger state indicators.

§dark: bool

Whether this is a dark theme; affects luminosity calculations.

§luminosity_spread: f64

Luminosity delta per shade step for lighten/darken operations.

§variables: HashMap<String, TcssColor>

User-defined variable overrides. Checked before computed shades.

Implementations§

Source§

impl Theme

Source

pub fn resolve(&self, name: &str) -> Option<TcssColor>

Resolve a theme variable name to a concrete color.

Supports base names ("primary") and shade variants ("primary-lighten-2", "accent-darken-1"). Checks variables HashMap first for user overrides.

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Theme

Source§

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

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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<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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.