Struct Theme

Source
pub struct Theme {
    pub window_bg: Color,
    pub titlebar_bg: Color,
    pub button_bg: Color,
    pub button_bg_hover: Color,
    pub button_bg_pressed: Color,
    pub close_bg_hover: Color,
    pub close_bg_pressed: Color,
    pub titlebar_control_hover: Color,
    pub titlebar_control_pressed: Color,
    pub icon_fg: Color,
}
Expand description

Semantic color tokens for built-in chrome and controls.

§Examples

use ailloli_ui_core::style::Theme;
let theme = Theme::dark();
assert_ne!(theme.button_bg, theme.window_bg);

Fields§

§window_bg: Color

Client window background.

§titlebar_bg: Color

Title bar background (client chrome).

§button_bg: Color

Normal action-button fill.

§button_bg_hover: Color

Action-button fill while hovered.

§button_bg_pressed: Color

Action-button fill while pressed.

§close_bg_hover: Color

Destructive close-control fill while hovered.

§close_bg_pressed: Color

Destructive close-control fill while pressed.

§titlebar_control_hover: Color

Hover fill for minimize/maximize title-bar controls.

§titlebar_control_pressed: Color

Pressed fill for minimize/maximize title-bar controls.

§icon_fg: Color

Default icon foreground on chrome.

Implementations§

Source§

impl Theme

Source

pub fn dark() -> Self

Returns the built-in dark theme with orange action accents.

§Examples
use ailloli_ui_core::style::Theme;
assert_eq!(Theme::dark().button_bg.as_rgba8(), (255, 90, 0, 255));
Source

pub fn palette(self) -> ThemePalette

Returns the built-in semantic color palette.

The current palette is a fixed bundle and is not recomputed from mutable public chrome fields on Theme.

§Examples
use ailloli_ui_core::style::Theme;
assert_eq!(Theme::dark().palette().accent.as_rgba8(), (255, 90, 0, 255));
Source

pub const fn radius(self) -> ThemeRadius

Returns the fixed 4/8/12/16 logical-pixel radius scale.

§Examples
use ailloli_ui_core::style::Theme;
assert_eq!((Theme::dark().radius().sm, Theme::dark().radius().xl), (4.0, 16.0));
Source

pub const fn spacing(self) -> ThemeSpacing

Returns the fixed 4/8/12/16/24 logical-pixel spacing scale.

§Examples
use ailloli_ui_core::style::Theme;
assert_eq!(Theme::dark().spacing().md, 12.0);
Source

pub fn typography(self) -> ThemeTypography

Builds standard text styles using the built-in palette text color.

Sizes are 12, 14, and 18 logical pixels for UI text and 14 for monospace text.

§Examples
use ailloli_ui_core::FontId;
use ailloli_ui_core::style::Theme;
assert_eq!(Theme::dark().typography().mono_md.font, FontId::Mono);
Source

pub fn shadows(self) -> ThemeShadows

Returns small, medium, and large BoxShadow presets.

§Examples
use ailloli_ui_core::style::Theme;
assert_eq!(Theme::dark().shadows().lg.blur_radius, 24.0);

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a copy 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 Copy for Theme

Auto Trait Implementations§

§

impl Freeze for Theme

§

impl RefUnwindSafe for Theme

§

impl Send for Theme

§

impl Sync for Theme

§

impl Unpin 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> 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> 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.