Struct theme2::ColorScale
source · pub struct ColorScale(_);
Implementations§
source§impl ColorScale
impl ColorScale
sourcepub fn step(&self, step: ColorScaleStep) -> Hsla
pub fn step(&self, step: ColorScaleStep) -> Hsla
Returns the specified step in the ColorScale
.
sourcepub fn step_1(&self) -> Hsla
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.
sourcepub fn step_2(&self) -> Hsla
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.
sourcepub fn step_3(&self) -> Hsla
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.
sourcepub fn step_4(&self) -> Hsla
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.
sourcepub fn step_5(&self) -> Hsla
pub fn step_5(&self) -> Hsla
Step 5
- Used for UI component backgrounds in their pressed or selected states.
sourcepub fn step_6(&self) -> Hsla
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.
sourcepub fn step_7(&self) -> Hsla
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.
sourcepub fn step_8(&self) -> Hsla
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.
sourcepub fn step_9(&self) -> Hsla
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.
sourcepub fn step_10(&self) -> Hsla
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.