Skip to main content

Tones

Struct Tones 

Source
#[non_exhaustive]
pub struct Tones {
Show 25 fields pub content: Option<Color>, pub secondary: Option<Color>, pub muted: Option<Color>, pub disabled: Option<Color>, pub action: Option<Color>, pub on_action: Option<Color>, pub info: Option<Color>, pub success: Option<Color>, pub warning: Option<Color>, pub danger: Option<Color>, pub info_surface: Option<Color>, pub success_surface: Option<Color>, pub warning_surface: Option<Color>, pub danger_surface: Option<Color>, pub neutral_surface: Option<Color>, pub border: Option<Color>, pub sunken: Option<Color>, pub ground: Option<Color>, pub stripe: Option<Color>, pub selected: Option<Color>, pub heat_0: Option<Color>, pub heat_1: Option<Color>, pub heat_2: Option<Color>, pub heat_3: Option<Color>, pub heat_4: Option<Color>,
}
Expand description

The colours text, controls and tables are drawn in.

Each is optional, and an empty one is a real answer: the terminal’s own ink. Where a role has no colour, the drawing says it with a modifier instead (muted text dims, a danger line is bold, a link is underlined, the cursor row is reversed), which is what a terminal with no colour to spend has left. Tones::NONE is that terminal.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§content: Option<Color>

Ordinary content, and what a neutral tone reads as. content-primary.

§secondary: Option<Color>

Content one step back: a field’s label, a column heading. content-secondary.

§muted: Option<Color>

Content two steps back: a caption, a hint, a reading. content-muted.

§disabled: Option<Color>

The label of a control that will not answer, fainter than any hint. content-disabled.

§action: Option<Color>

Text that goes somewhere, and a control’s label. action-primary.

§on_action: Option<Color>

Text legible on action, for a control filled with it.

§info: Option<Color>

Something worth knowing and nothing to do about it. status-info.

§success: Option<Color>

Something finished and it worked. status-success.

§warning: Option<Color>

Something the user should look at. status-warning.

§danger: Option<Color>

Something broken, or about to be destroyed. status-danger.

§info_surface: Option<Color>

The fill of an info badge. info-surface.

§success_surface: Option<Color>

The fill of a success badge. success-surface.

§warning_surface: Option<Color>

The fill of a warning badge. warning-surface.

§danger_surface: Option<Color>

The fill of a danger badge. danger-surface.

§neutral_surface: Option<Color>

The fill of a neutral badge. row-hover, the weight the tone fills sit at.

§border: Option<Color>

A neutral badge’s edge. line-border.

§sunken: Option<Color>

A surface set back from the one it sits on: a code run, a table’s heading strip. surface-sunken.

§ground: Option<Color>

What a table’s rows sit on. surface-raised.

§stripe: Option<Color>

What every second table row sits on. surface-page: a step of the theme’s neutral ramp, not a tone of its own.

§selected: Option<Color>

The row under the cursor. row-selected.

§heat_0: Option<Color>

The measure ramp’s fills, quietest first: heat-0 to heat-4. A background and never an ink, read through Ink::heat.

§heat_1: Option<Color>

heat-1.

§heat_2: Option<Color>

heat-2.

§heat_3: Option<Color>

heat-3.

§heat_4: Option<Color>

heat-4.

Implementations§

Source§

impl Tones

Source

pub const NONE: Self

No colours at all: every role drawn in the terminal’s own ink, and carried by modifiers.

Source

pub const fn content(self, color: Color) -> Self

Set content.

Source

pub const fn secondary(self, color: Color) -> Self

Set secondary.

Source

pub const fn muted(self, color: Color) -> Self

Set muted.

Source

pub const fn disabled(self, color: Color) -> Self

Set disabled.

Source

pub const fn action(self, color: Color) -> Self

Set action.

Source

pub const fn on_action(self, color: Color) -> Self

Set on_action.

Source

pub const fn info(self, color: Color) -> Self

Set info.

Source

pub const fn success(self, color: Color) -> Self

Set success.

Source

pub const fn warning(self, color: Color) -> Self

Set warning.

Source

pub const fn danger(self, color: Color) -> Self

Set danger.

Source

pub const fn info_surface(self, color: Color) -> Self

Source

pub const fn success_surface(self, color: Color) -> Self

Source

pub const fn warning_surface(self, color: Color) -> Self

Source

pub const fn danger_surface(self, color: Color) -> Self

Source

pub const fn neutral_surface(self, color: Color) -> Self

Source

pub const fn border(self, color: Color) -> Self

Set border.

Source

pub const fn sunken(self, color: Color) -> Self

Set sunken.

Source

pub const fn ground(self, color: Color) -> Self

Set ground.

Source

pub const fn stripe(self, color: Color) -> Self

Set stripe.

Source

pub const fn selected(self, color: Color) -> Self

Set selected.

Source

pub const fn heat_0(self, color: Color) -> Self

Set heat_0.

Source

pub const fn heat_1(self, color: Color) -> Self

Set heat_1.

Source

pub const fn heat_2(self, color: Color) -> Self

Set heat_2.

Source

pub const fn heat_3(self, color: Color) -> Self

Set heat_3.

Source

pub const fn heat_4(self, color: Color) -> Self

Set heat_4.

Trait Implementations§

Source§

impl Clone for Tones

Source§

fn clone(&self) -> Self

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 Tones

Source§

impl Debug for Tones

Source§

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

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

impl Default for Tones

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Tones

Source§

impl PartialEq for Tones

Source§

fn eq(&self, other: &Self) -> 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 Tones

Auto Trait Implementations§

§

impl Forget for Tones

§

impl Freeze for Tones

§

impl Move for Tones

§

impl RefUnwindSafe for Tones

§

impl Send for Tones

§

impl Sync for Tones

§

impl Unpin for Tones

§

impl UnsafeUnpin for Tones

§

impl UnwindSafe for Tones

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

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.