Skip to main content

Palette

Struct Palette 

Source
pub struct Palette {
    pub page: Color32,
    pub raised: Color32,
    pub overlay: Color32,
    pub well: Color32,
    pub sunken: Color32,
    pub bevel_light: Color32,
    pub bevel_dark: Color32,
}
Expand description

The resolved colours this renderer needs, as flat values.

Built by the app from whatever it already uses to resolve a theme, then held and reused. Deliberately not a trait and not string-keyed: a bevel is painted per widget per frame, and a map lookup per edge is a cost with nothing to show for it.

Fields§

§page: Color32

surface-page.

§raised: Color32

surface-raised.

§overlay: Color32

surface-overlay.

§well: Color32

surface-well.

Required, not optional. makeover derives it for every theme from 2.3.0, so a resolved palette without a well is not a thing that exists here. It was an Option while that was untrue, and this renderer substituted the page; makeover-tui keeps its own Option for a different reason, since a terminal can have the colour and still be unable to show it.

§sunken: Color32

surface-sunken.

A surface set back from the one it sits on, by colour and nothing else. Not a well: a well is a hole with an edge, and this has no edge. An immediate-mode renderer paints an arbitrary rect, so unlike makeover-tui it has no excuse for declining this one.

Required rather than optional, on the same footing as well: all 31 themes makeover embeds author it.

§bevel_light: Color32

bevel-light.

§bevel_dark: Color32

bevel-dark.

Implementations§

Source§

impl Palette

Source

pub const fn fill(&self, fill: Fill) -> Option<Color32>

Resolve a surface intent, or None for one this renderer does not know.

A plain lookup. There is still no substitution: the old one existed only while surface-well was underived, and every consumer reads the real token now.

Option since 0.3.0, because Fill became #[non_exhaustive] in makeover-layout 0.4.0 and a total function over an open enum can only stay total by inventing a colour for a member it has never heard of. That is the substitution this crate spent 0.2.0 removing, so the return type moved instead. Every member the description has today is answered with Some.

Source

pub const fn edge(&self, edge: Edge) -> Color32

Resolve a bevel edge intent.

Trait Implementations§

Source§

impl Clone for Palette

Source§

fn clone(&self) -> Palette

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

Source§

impl Debug for Palette

Source§

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

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

impl Eq for Palette

Source§

impl PartialEq for Palette

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> 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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

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

Source§

fn simd_from(_simd: S, value: T) -> 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.