Skip to main content

Theme

Struct Theme 

Source
pub struct Theme {
    pub colors: ColorPalette,
    pub spacing: Spacing,
    pub typography: Typography,
}
Expand description

Complete theme with colors and spacing

§Example

use armas_basic::Theme;

let theme = Theme::dark();
let bg = theme.background();
let fg = theme.foreground();
let primary = theme.primary();

Fields§

§colors: ColorPalette

Color palette

§spacing: Spacing

Spacing configuration

§typography: Typography

Typography / font size scale

Implementations§

Source§

impl Theme

Source

pub const fn dark() -> Self

Dark theme using Zinc color palette (shadcn default)

Source

pub const fn light() -> Self

Light theme using Zinc color palette

Source

pub const fn background(&self) -> Color32

Background color

Source

pub const fn foreground(&self) -> Color32

Foreground/text color

Source

pub const fn card(&self) -> Color32

Card background color

Source

pub const fn card_foreground(&self) -> Color32

Card foreground color

Source

pub const fn popover(&self) -> Color32

Popover background color

Source

pub const fn popover_foreground(&self) -> Color32

Popover foreground color

Source

pub const fn primary(&self) -> Color32

Primary brand color

Source

pub const fn primary_foreground(&self) -> Color32

Primary foreground color

Source

pub const fn secondary(&self) -> Color32

Secondary color

Source

pub const fn secondary_foreground(&self) -> Color32

Secondary foreground color

Source

pub const fn muted(&self) -> Color32

Muted color (subtle backgrounds)

Source

pub const fn muted_foreground(&self) -> Color32

Muted foreground color

Source

pub const fn accent(&self) -> Color32

Accent color

Source

pub const fn accent_foreground(&self) -> Color32

Accent foreground color

Source

pub const fn destructive(&self) -> Color32

Destructive/error color

Source

pub const fn destructive_foreground(&self) -> Color32

Destructive foreground color

Source

pub const fn border(&self) -> Color32

Border color

Source

pub const fn input(&self) -> Color32

Input border color

Source

pub const fn ring(&self) -> Color32

Focus ring color

Source

pub const fn chart_1(&self) -> Color32

Chart color 1 (blue)

Source

pub const fn chart_2(&self) -> Color32

Chart color 2 (green) - also used for success

Source

pub const fn chart_3(&self) -> Color32

Chart color 3 (yellow) - also used for warning

Source

pub const fn chart_4(&self) -> Color32

Chart color 4 (purple) - also used for info

Source

pub const fn chart_5(&self) -> Color32

Chart color 5 (orange)

Source

pub const fn hover(&self) -> Color32

Hover state color

Source

pub const fn focus(&self) -> Color32

Focus state color

Source

pub const fn sidebar(&self) -> Color32

Sidebar background color

Source

pub const fn sidebar_foreground(&self) -> Color32

Sidebar foreground/text color

Source

pub const fn sidebar_primary(&self) -> Color32

Sidebar primary color

Source

pub const fn sidebar_primary_foreground(&self) -> Color32

Sidebar primary foreground color

Source

pub const fn sidebar_accent(&self) -> Color32

Sidebar accent color (hover/active background)

Source

pub const fn sidebar_accent_foreground(&self) -> Color32

Sidebar accent foreground color

Source

pub const fn sidebar_border(&self) -> Color32

Sidebar border color

Source

pub const fn sidebar_ring(&self) -> Color32

Sidebar focus ring color

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

impl Default for Theme

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Theme

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Theme

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,