Struct theme2::ColorScale

source ·
pub struct ColorScale(_);

Implementations§

source§

impl ColorScale

source

pub fn step(&self, step: ColorScaleStep) -> Hsla

Returns the specified step in the ColorScale.

source

pub fn step_1(&self) -> Hsla

Step 1 - Used for main application backgrounds.

This step provides a neutral base for any overlaying components, ideal for applications’ main backdrop or empty spaces such as canvas areas.

source

pub fn step_2(&self) -> Hsla

Step 2 - Used for both main application backgrounds and subtle component backgrounds.

Like Step 1, this step allows variations in background styles, from striped tables, sidebar backgrounds, to card backgrounds.

source

pub fn step_3(&self) -> Hsla

Step 3 - Used for UI component backgrounds in their normal states.

This step maintains accessibility by guaranteeing a contrast ratio of 4.5:1 with steps 11 and 12 for text. It could also suit hover states for transparent components.

source

pub fn step_4(&self) -> Hsla

Step 4 - Used for UI component backgrounds in their hover states.

Also suited for pressed or selected states of components with a transparent background.

source

pub fn step_5(&self) -> Hsla

Step 5 - Used for UI component backgrounds in their pressed or selected states.

source

pub fn step_6(&self) -> Hsla

Step 6 - Used for subtle borders on non-interactive components.

Its usage spans from sidebars’ borders, headers’ dividers, cards’ outlines, to alerts’ edges and separators.

source

pub fn step_7(&self) -> Hsla

Step 7 - Used for subtle borders on interactive components.

This step subtly delineates the boundary of elements users interact with.

source

pub fn step_8(&self) -> Hsla

Step 8 - Used for stronger borders on interactive components and focus rings.

It strengthens the visibility and accessibility of active elements and their focus states.

source

pub fn step_9(&self) -> Hsla

Step 9 - Used for solid backgrounds.

Step 9 is the most saturated step, having the least mix of white or black.

Due to its high chroma, Step 9 is versatile and particularly useful for semantic colors such as error, warning, and success indicators.

source

pub fn step_10(&self) -> Hsla

Step 10 - Used for hovered or active solid backgrounds, particularly when Step 9 is their normal state.

May also be used for extremely low contrast text. This should be used sparingly, as it may be difficult to read.

source

pub fn step_11(&self) -> Hsla

Step 11 - Used for text and icons requiring low contrast or less emphasis.

source

pub fn step_12(&self) -> Hsla

Step 12 - Used for text and icons requiring high contrast or prominence.

Trait Implementations§

source§

impl FromIterator<Hsla> for ColorScale

source§

fn from_iter<T: IntoIterator<Item = Hsla>>(iter: T) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more