Skip to main content

Palette

Struct Palette 

Source
pub struct Palette {
Show 22 fields pub is_dark: bool, pub bg: Color32, pub card: Color32, pub input_bg: Color32, pub border: Color32, pub text: Color32, pub text_muted: Color32, pub text_faint: Color32, pub blue: Color32, pub blue_hover: Color32, pub green: Color32, pub green_hover: Color32, pub red: Color32, pub red_hover: Color32, pub purple: Color32, pub purple_hover: Color32, pub amber: Color32, pub amber_hover: Color32, pub sky: Color32, pub success: Color32, pub danger: Color32, pub warning: Color32,
}
Expand description

All the colours used by the design system.

You can tweak individual fields before calling Theme::install if you want to nudge the default slate look.

Fields§

§is_dark: bool

Whether this palette is a dark-mode palette.

Drives Visuals::dark vs Visuals::light and flips the direction of subtle-lift mixes (see Palette::depth_tint). If you build a custom palette, set this to match the luminance of bg / card.

§bg: Color32

Overall application background.

§card: Color32

Card / panel surface colour.

§input_bg: Color32

Input field background (typically the same as bg).

§border: Color32

Border colour used for inputs, cards and separators.

§text: Color32

Primary text colour.

§text_muted: Color32

Secondary text (labels, field captions).

§text_faint: Color32

Tertiary text (hints, placeholders, disabled-ish).

§blue: Color32

Blue accent, resting state — backs Accent::Blue.

§blue_hover: Color32

Blue accent, hover/pressed state.

§green: Color32

Green accent, resting state — backs Accent::Green.

§green_hover: Color32

Green accent, hover/pressed state.

§red: Color32

Red accent, resting state — backs Accent::Red.

§red_hover: Color32

Red accent, hover/pressed state.

§purple: Color32

Purple accent, resting state — backs Accent::Purple.

§purple_hover: Color32

Purple accent, hover/pressed state.

§amber: Color32

Amber accent, resting state — backs Accent::Amber.

§amber_hover: Color32

Amber accent, hover/pressed state.

§sky: Color32

The sky blue used for focus rings, active tabs, and “dirty” input bars.

§success: Color32

Success accent used by the status light and flashy feedback.

§danger: Color32

Danger accent used by the status light and flashy feedback.

§warning: Color32

Warning accent used by the “connecting” status light.

Implementations§

Source§

impl Palette

Source

pub fn slate() -> Self

The default “slate” palette — cool corporate dark blue with a sky focus ring. Matches the reference design.

Source

pub fn charcoal() -> Self

The “charcoal” palette — a neutral dark-grey surface with a cyan focus accent. Minimalist and monochrome compared to the blue-tinged Palette::slate.

Source

pub fn frost() -> Self

The “frost” palette — the light-mode counterpart to Palette::slate. Slate-tinted off-white surfaces, deep slate text, and the same cool accent family with slightly deepened shades so white-on-accent button labels remain legible.

Source

pub fn paper() -> Self

The “paper” palette — the light-mode counterpart to Palette::charcoal. Warm neutral off-white surfaces with a darkened cyan focus accent to match charcoal’s cool accent flavour.

Source

pub fn depth_tint(&self, base: Color32, t: f32) -> Color32

Mix base toward a “more recessed” colour by factor t.

In dark palettes this mixes toward white (adding luminance — a subtle lift); in light palettes it mixes toward black (removing luminance — a subtle shade). Either way the result pops slightly off the neighbouring surface. Used for hover states on otherwise plain fills, and the faint card-ish backgrounds.

Source

pub fn accent_fill(&self, accent: Accent) -> Color32

Resolve the resting fill colour for a given accent.

Source

pub fn accent_hover(&self, accent: Accent) -> Color32

Resolve the hover / pressed fill colour for a given accent.

Trait Implementations§

Source§

impl Clone for Palette

Source§

fn clone(&self) -> Palette

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 Palette

Source§

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

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

impl PartialEq for Palette

Source§

fn eq(&self, other: &Palette) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 StructuralPartialEq for Palette

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> 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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,