Skip to main content

ThemeTokens

Struct ThemeTokens 

Source
pub struct ThemeTokens {
Show 71 fields pub background: Hsla, pub foreground: Hsla, pub card: Hsla, pub card_foreground: Hsla, pub popover: Hsla, pub popover_foreground: Hsla, pub muted: Hsla, pub muted_foreground: Hsla, pub accent: Hsla, pub accent_foreground: Hsla, pub primary: Hsla, pub primary_foreground: Hsla, pub secondary: Hsla, pub secondary_foreground: Hsla, pub destructive: Hsla, pub destructive_foreground: Hsla, pub border: Hsla, pub input: Hsla, pub ring: Hsla, pub radius_sm: Pixels, pub radius_md: Pixels, pub radius_lg: Pixels, pub radius_xl: Pixels, pub shadow_xs: BoxShadow, pub shadow_sm: BoxShadow, pub shadow_md: BoxShadow, pub shadow_lg: BoxShadow, pub shadow_xl: BoxShadow, pub ring_offset: Pixels, pub transition_fast: Duration, pub transition_base: Duration, pub transition_slow: Duration, pub font_family: SharedString, pub font_mono: SharedString, pub spacing_1: Pixels, pub spacing_2: Pixels, pub spacing_3: Pixels, pub spacing_4: Pixels, pub spacing_5: Pixels, pub spacing_6: Pixels, pub spacing_8: Pixels, pub spacing_10: Pixels, pub spacing_12: Pixels, pub spacing_16: Pixels, pub duration_fastest: Duration, pub duration_faster: Duration, pub duration_fast: Duration, pub duration_normal: Duration, pub duration_slow: Duration, pub duration_slower: Duration, pub duration_slowest: Duration, pub z_dropdown: u32, pub z_sticky: u32, pub z_modal: u32, pub z_popover: u32, pub z_tooltip: u32, pub text_xs: Pixels, pub text_sm: Pixels, pub text_base: Pixels, pub text_lg: Pixels, pub text_xl: Pixels, pub text_2xl: Pixels, pub text_3xl: Pixels, pub text_4xl: Pixels, pub text_5xl: Pixels, pub leading_none: f32, pub leading_tight: f32, pub leading_snug: f32, pub leading_normal: f32, pub leading_relaxed: f32, pub leading_loose: f32,
}
Expand description

Shadcn-inspired semantic color and layout tokens

Fields§

§background: Hsla§foreground: Hsla§card: Hsla§card_foreground: Hsla§popover: Hsla§popover_foreground: Hsla§muted: Hsla§muted_foreground: Hsla§accent: Hsla§accent_foreground: Hsla§primary: Hsla§primary_foreground: Hsla§secondary: Hsla§secondary_foreground: Hsla§destructive: Hsla§destructive_foreground: Hsla§border: Hsla§input: Hsla§ring: Hsla§radius_sm: Pixels§radius_md: Pixels§radius_lg: Pixels§radius_xl: Pixels§shadow_xs: BoxShadow§shadow_sm: BoxShadow§shadow_md: BoxShadow§shadow_lg: BoxShadow§shadow_xl: BoxShadow§ring_offset: Pixels§transition_fast: Duration§transition_base: Duration§transition_slow: Duration§font_family: SharedString§font_mono: SharedString§spacing_1: Pixels§spacing_2: Pixels§spacing_3: Pixels§spacing_4: Pixels§spacing_5: Pixels§spacing_6: Pixels§spacing_8: Pixels§spacing_10: Pixels§spacing_12: Pixels§spacing_16: Pixels§duration_fastest: Duration§duration_faster: Duration§duration_fast: Duration§duration_normal: Duration§duration_slow: Duration§duration_slower: Duration§duration_slowest: Duration§z_dropdown: u32§z_sticky: u32§z_modal: u32§z_popover: u32§z_tooltip: u32§text_xs: Pixels§text_sm: Pixels§text_base: Pixels§text_lg: Pixels§text_xl: Pixels§text_2xl: Pixels§text_3xl: Pixels§text_4xl: Pixels§text_5xl: Pixels§leading_none: f32§leading_tight: f32§leading_snug: f32§leading_normal: f32§leading_relaxed: f32§leading_loose: f32

Implementations§

Source§

impl ThemeTokens

Source

pub fn light() -> Self

Source

pub fn dark() -> Self

Source

pub fn midnight_blue() -> Self

Source

pub fn forest_grove() -> Self

Source

pub fn sunset_amber() -> Self

Source

pub fn ocean_breeze() -> Self

Source

pub fn dracula() -> Self

Source

pub fn nord() -> Self

Source

pub fn monokai_pro() -> Self

Source

pub fn tokyo_night() -> Self

Source

pub fn catppuccin_mocha() -> Self

Source

pub fn rose_pine() -> Self

Source

pub fn coral_reef() -> Self

Source

pub fn lavender_dreams() -> Self

Source

pub fn mint_fresh() -> Self

Source

pub fn peachy_keen() -> Self

Source

pub fn sky_blue() -> Self

Source

pub fn cherry_blossom() -> Self

Source§

impl ThemeTokens

Source

pub fn gradient_primary(&self) -> Background

Source

pub fn gradient_surface(&self) -> Background

Source

pub fn gradient_accent(&self) -> Background

Source

pub fn gradient_destructive(&self) -> Background

Source

pub fn glow_shadow(&self, color: Hsla, intensity: f32) -> BoxShadow

Source

pub fn colored_shadow(&self, color: Hsla, size: f32) -> BoxShadow

Source

pub fn focus_ring_animated(&self, progress: f32) -> BoxShadow

Source

pub fn focus_ring(&self, opacity: f32) -> BoxShadow

Create a focus ring shadow (3px spread with opacity)

Source

pub fn focus_ring_light(&self) -> BoxShadow

Create a focus ring for light backgrounds

Source

pub fn focus_ring_dark(&self) -> BoxShadow

Create a focus ring for dark backgrounds

Source

pub fn error_ring(&self) -> BoxShadow

Create a validation error ring

Source

pub fn success_ring(&self) -> BoxShadow

Create a success ring (for validated inputs)

Source

pub fn inset_shadow_top(&self, intensity: f32) -> BoxShadow

Source

pub fn inset_shadow_bottom(&self, intensity: f32) -> BoxShadow

Source

pub fn inset_shadow_both(&self, intensity: f32) -> Vec<BoxShadow>

Source

pub fn elevation_shadow(&self, level: u8) -> Vec<BoxShadow>

Source

pub fn layered_gradient(&self, angle: f32, colors: &[Hsla]) -> Vec<Background>

Trait Implementations§

Source§

impl Clone for ThemeTokens

Source§

fn clone(&self) -> Self

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 Debug for ThemeTokens

Source§

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

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

impl Default for ThemeTokens

Source§

fn default() -> Self

The light theme’s tokens. Custom themes can start from here and override individual fields via struct update syntax, e.g. ThemeTokens { primary: my_brand_color.into(), ..Default::default() }.

Auto Trait Implementations§

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more