Palette

Struct Palette 

Source
pub struct Palette {
    pub background: Rgba,
    pub foreground: Rgba,
    pub surface: Rgba,
    pub outline: Rgba,
    pub contrast: Rgba,
    pub primary: Rgba,
    pub secondary: Rgba,
    pub accent: Rgba,
    pub danger: Rgba,
    pub success: Rgba,
    pub warning: Rgba,
    pub info: Rgba,
}
Expand description

A color palette used by the common crate::views

Fields§

§background: Rgba

The background color

§foreground: Rgba

The foreground color

§surface: Rgba

A color close to the background, but more visible

§outline: Rgba

A color used to outline things. This is generally like surface, but even more visible

§contrast: Rgba

A color used to contrast something against the background

§primary: Rgba

A color used for a primary action – e.g. the default interaction color

§secondary: Rgba

A color used for a secondary action – e.g an interaction color that is different from the primary color

§accent: Rgba

A accent color used to differentiate something from a primary and secondary color

§danger: Rgba

A color representing that something is dangerous

§success: Rgba

A color representing that something is successful

§warning: Rgba

A color representing that something is potentially dangerous

§info: Rgba

A coloe representing that something should be noted

Implementations§

Source§

impl Palette

Source

pub fn is_dark(&self) -> bool

Is this background’s luminosity considered ‘dark’?

Source

pub fn is_light(&self) -> bool

Is this background’s luminosity considered ‘light’?

Source

pub const fn dark() -> Self

A default “dark” palette

§A visualization of this palette
ColorVisualization
foreground#FFFFFF
surface#232323
outline#4D4D4D
contrast#A9E9E9
primary#55B1F0
secondary#8C8BED
accent#F4A151
danger#F05D61
success#9AF07A
warning#F9F35F
info#6A7DDA

(All text is on the Palette::background color)

Source

pub const fn light() -> Self

A default “light” palette

§A visualization of this palette
ColorVisualization
foreground#000000
surface#C3C5C8
outline#9D9099
contrast#663696
primary#8175DF
secondary#28758D
accent#776BC2
danger#C7343B
success#33D17A
warning#F9F35F
info#0077C2

(All text is on the Palette::background color)

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 Default for Palette

Source§

fn default() -> Self

Returns the “default value” for a type. 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 Copy for Palette

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