Skip to main content

Palette

Struct Palette 

Source
pub struct Palette {
    pub page: Color,
    pub raised: Color,
    pub overlay: Color,
    pub well: Option<Color>,
    pub bevel_light: Color,
    pub bevel_dark: Color,
}
Expand description

The resolved colours this renderer needs.

Supply them already quantised to whatever the terminal can show. That is what makes Palette::shows a plain inequality rather than a colour-space calculation: by the time a colour reaches here, the question of what the terminal will actually paint has been answered.

Fields§

§page: Color

surface-page.

§raised: Color

surface-raised.

§overlay: Color

surface-overlay.

§well: Option<Color>

surface-well, absent on makeover before 2.3.0.

§bevel_light: Color

bevel-light.

§bevel_dark: Color

bevel-dark.

Implementations§

Source§

impl Palette

Source

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

Resolve a surface intent, or None where the theme has no such colour.

No substitution happens here. A missing intent stays missing, and frame answers it with structure instead of with a different colour.

Source

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

Resolve a bevel edge intent.

Source

pub fn shows(fill: Color, behind: Color) -> bool

Whether painting fill over behind would show anything.

The whole of the terminal’s problem in one predicate. On a truecolor terminal this is almost always true; in sixteen colours it is false often enough that a design relying on fills is a design that vanishes.

Source

pub fn two_tone(&self) -> bool

Whether this palette can express a bevel as two distinct edges.

When the two edge colours quantise together the frame reads as a plain box rather than a lit one. That is a degradation, not a failure: one box is still a boundary. makeover’s own test suite already names the shipped themes where it happens.

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

Compare self to key and return true if they are equal.
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> 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.