pub struct Scheme {Show 17 fields
pub white: [Color; 4],
pub black: [Color; 4],
pub gray: [Color; 4],
pub red: [Color; 4],
pub orange: [Color; 4],
pub yellow: [Color; 4],
pub limegreen: [Color; 4],
pub green: [Color; 4],
pub bluegreen: [Color; 4],
pub cyan: [Color; 4],
pub blue: [Color; 4],
pub deepblue: [Color; 4],
pub purple: [Color; 4],
pub magenta: [Color; 4],
pub redpink: [Color; 4],
pub primary: [Color; 4],
pub secondary: [Color; 4],
}Expand description
Color scheme.
This provides the palette used for a theme.
The ideas packed in here are
- provide two colors for highlighting and accents.
- I always want some white, black and gray.
- I don’t want to miss out anything, so go once round the hue in HSV. Take steps of 30° then we hit pretty much anything interesting.
- Just one variant of each color is not enough, make it 4.
Fields§
§white: [Color; 4]§black: [Color; 4]§gray: [Color; 4]§red: [Color; 4]§orange: [Color; 4]§yellow: [Color; 4]§limegreen: [Color; 4]§green: [Color; 4]§bluegreen: [Color; 4]§cyan: [Color; 4]§blue: [Color; 4]§deepblue: [Color; 4]§purple: [Color; 4]§magenta: [Color; 4]§redpink: [Color; 4]§primary: [Color; 4]§secondary: [Color; 4]Implementations§
Source§impl Scheme
impl Scheme
Sourcepub fn limegreen(&self, n: usize) -> Style
pub fn limegreen(&self, n: usize) -> Style
Create a style from the given limegreen shade.
n is 0..=3
Sourcepub fn bluegreen(&self, n: usize) -> Style
pub fn bluegreen(&self, n: usize) -> Style
Create a style from the given bluegreen shade.
n is 0..=3
Sourcepub fn deepblue(&self, n: usize) -> Style
pub fn deepblue(&self, n: usize) -> Style
Create a style from the given deepblue shade.
n is 0..=3
Sourcepub fn magenta(&self, n: usize) -> Style
pub fn magenta(&self, n: usize) -> Style
Create a style from the given magenta shade.
n is 0..=3
Sourcepub fn redpink(&self, n: usize) -> Style
pub fn redpink(&self, n: usize) -> Style
Create a style from the given redpink shade.
n is 0..=3
Source§impl Scheme
impl Scheme
Sourcepub fn true_dark_white(&self, n: usize) -> Style
pub fn true_dark_white(&self, n: usize) -> Style
Create a style from the given white shade.
n is 0..=3
Sourcepub fn true_dark_black(&self, n: usize) -> Style
pub fn true_dark_black(&self, n: usize) -> Style
Create a style from the given black shade.
n is 0..=3
Sourcepub fn true_dark_gray(&self, n: usize) -> Style
pub fn true_dark_gray(&self, n: usize) -> Style
Create a style from the given gray shade.
n is 0..=3
Sourcepub fn true_dark_red(&self, n: usize) -> Style
pub fn true_dark_red(&self, n: usize) -> Style
Create a style from the given red shade.
n is 0..=3
Sourcepub fn true_dark_orange(&self, n: usize) -> Style
pub fn true_dark_orange(&self, n: usize) -> Style
Create a style from the given orange shade.
n is 0..=3
Sourcepub fn true_dark_yellow(&self, n: usize) -> Style
pub fn true_dark_yellow(&self, n: usize) -> Style
Create a style from the given yellow shade.
n is 0..=3
Sourcepub fn true_dark_limegreen(&self, n: usize) -> Style
pub fn true_dark_limegreen(&self, n: usize) -> Style
Create a style from the given limegreen shade.
n is 0..=3
Sourcepub fn true_dark_green(&self, n: usize) -> Style
pub fn true_dark_green(&self, n: usize) -> Style
Create a style from the given green shade.
n is 0..=3
Sourcepub fn true_dark_bluegreen(&self, n: usize) -> Style
pub fn true_dark_bluegreen(&self, n: usize) -> Style
Create a style from the given bluegreen shade.
n is 0..=3
Sourcepub fn true_dark_cyan(&self, n: usize) -> Style
pub fn true_dark_cyan(&self, n: usize) -> Style
Create a style from the given cyan shade.
n is 0..=3
Sourcepub fn true_dark_blue(&self, n: usize) -> Style
pub fn true_dark_blue(&self, n: usize) -> Style
Create a style from the given blue shade.
n is 0..=3
Sourcepub fn true_dark_deepblue(&self, n: usize) -> Style
pub fn true_dark_deepblue(&self, n: usize) -> Style
Create a style from the given deepblue shade.
n is 0..=3
Sourcepub fn true_dark_purple(&self, n: usize) -> Style
pub fn true_dark_purple(&self, n: usize) -> Style
Create a style from the given purple shade.
n is 0..=3
Sourcepub fn true_dark_magenta(&self, n: usize) -> Style
pub fn true_dark_magenta(&self, n: usize) -> Style
Create a style from the given magenta shade.
n is 0..=3
Sourcepub fn true_dark_redpink(&self, n: usize) -> Style
pub fn true_dark_redpink(&self, n: usize) -> Style
Create a style from the given redpink shade.
n is 0..=3
Sourcepub fn true_dark_primary(&self, n: usize) -> Style
pub fn true_dark_primary(&self, n: usize) -> Style
Create a style from the given primary shade.
n is 0..=3
Sourcepub fn true_dark_secondary(&self, n: usize) -> Style
pub fn true_dark_secondary(&self, n: usize) -> Style
Create a style from the given secondary shade.
n is 0..=3
Source§impl Scheme
impl Scheme
Sourcepub fn reduced_white(&self, n: usize) -> Style
pub fn reduced_white(&self, n: usize) -> Style
Create a style from the given white shade.
n is 0..=3
Sourcepub fn reduced_black(&self, n: usize) -> Style
pub fn reduced_black(&self, n: usize) -> Style
Create a style from the given black shade.
n is 0..=3
Sourcepub fn reduced_gray(&self, n: usize) -> Style
pub fn reduced_gray(&self, n: usize) -> Style
Create a style from the given gray shade.
n is 0..=3
Sourcepub fn reduced_red(&self, n: usize) -> Style
pub fn reduced_red(&self, n: usize) -> Style
Create a style from the given red shade.
n is 0..=3
Sourcepub fn reduced_orange(&self, n: usize) -> Style
pub fn reduced_orange(&self, n: usize) -> Style
Create a style from the given orange shade.
n is 0..=3
Sourcepub fn reduced_yellow(&self, n: usize) -> Style
pub fn reduced_yellow(&self, n: usize) -> Style
Create a style from the given yellow shade.
n is 0..=3
Sourcepub fn reduced_limegreen(&self, n: usize) -> Style
pub fn reduced_limegreen(&self, n: usize) -> Style
Create a style from the given limegreen shade.
n is 0..=3
Sourcepub fn reduced_green(&self, n: usize) -> Style
pub fn reduced_green(&self, n: usize) -> Style
Create a style from the given green shade.
n is 0..=3
Sourcepub fn reduced_bluegreen(&self, n: usize) -> Style
pub fn reduced_bluegreen(&self, n: usize) -> Style
Create a style from the given bluegreen shade.
n is 0..=3
Sourcepub fn reduced_cyan(&self, n: usize) -> Style
pub fn reduced_cyan(&self, n: usize) -> Style
Create a style from the given cyan shade.
n is 0..=3
Sourcepub fn reduced_blue(&self, n: usize) -> Style
pub fn reduced_blue(&self, n: usize) -> Style
Create a style from the given blue shade.
n is 0..=3
Sourcepub fn reduced_deepblue(&self, n: usize) -> Style
pub fn reduced_deepblue(&self, n: usize) -> Style
Create a style from the given deepblue shade.
n is 0..=3
Sourcepub fn reduced_purple(&self, n: usize) -> Style
pub fn reduced_purple(&self, n: usize) -> Style
Create a style from the given purple shade.
n is 0..=3
Sourcepub fn reduced_magenta(&self, n: usize) -> Style
pub fn reduced_magenta(&self, n: usize) -> Style
Create a style from the given magenta shade.
n is 0..=3
Sourcepub fn reduced_redpink(&self, n: usize) -> Style
pub fn reduced_redpink(&self, n: usize) -> Style
Create a style from the given redpink shade.
n is 0..=3
Sourcepub fn reduced_primary(&self, n: usize) -> Style
pub fn reduced_primary(&self, n: usize) -> Style
Create a style from the given primary shade.
n is 0..=3
Sourcepub fn reduced_secondary(&self, n: usize) -> Style
pub fn reduced_secondary(&self, n: usize) -> Style
Create a style from the given secondary shade.
n is 0..=3
Source§impl Scheme
impl Scheme
Sourcepub fn style(&self, color: Color) -> Style
pub fn style(&self, color: Color) -> Style
Create a style with the given background color.
Foreground is calculated with text_color.
Sourcepub fn reduced_style(&self, color: Color) -> Style
pub fn reduced_style(&self, color: Color) -> Style
Create a style with the given background color.
Foreground is calculated with reduced_text_color.
Sourcepub fn true_dark_style(&self, color: Color) -> Style
pub fn true_dark_style(&self, color: Color) -> Style
Create a style with the given background color
converted with true_dark_color().
Foreground is calculated with text_color.
Sourcepub fn reduced_dark_style(&self, color: Color) -> Style
pub fn reduced_dark_style(&self, color: Color) -> Style
Create a style with the given background color.
converted with true_dark_color().
Foreground is calculated with reduced_text_color.
Sourcepub const fn linear4(c0: u32, c1: u32) -> [Color; 4]
pub const fn linear4(c0: u32, c1: u32) -> [Color; 4]
Linear interpolation between the two colors.
Sourcepub fn true_dark_color(&self, color: Color) -> Color
pub fn true_dark_color(&self, color: Color) -> Color
Reduces the range of the given color from 0..255 to 0..63.
This gives a true dark equivalent which can be used as a background for a dark theme.
Sourcepub fn grey_color(&self, color: Color) -> Color
pub fn grey_color(&self, color: Color) -> Color
Converts the given color to an equivalent grayscale.
Sourcepub fn text_color(&self, color: Color) -> Color
pub fn text_color(&self, color: Color) -> Color
This gives back white[3] or black[0] for text foreground
providing good contrast to the given background.
This converts RGB to grayscale and takes the grayscale value of VGA cyan as threshold, which is about 105 out of 255. This point is a bit arbitrary, just based on what I perceive as acceptable. But it produces a good reading contrast in my experience.
For the named colors it takes the VGA equivalent as a base. For indexed colors it splits the range in half as an estimate.
Sourcepub fn reduced_text_color(&self, color: Color) -> Color
pub fn reduced_text_color(&self, color: Color) -> Color
This gives back white[3] or black[0] for text foreground
providing good contrast to the given background.
This converts RGB to grayscale and takes the grayscale value of VGA cyan as threshold, which is about 105 out of 255. This point is a bit arbitrary, just based on what I perceive as acceptable. But it produces a good reading contrast in my experience.
For the named colors it takes the VGA equivalent as a base. For indexed colors it splits the range in half as an estimate.
Sourcepub fn rate_text_color(&self, color: Color) -> Option<bool>
pub fn rate_text_color(&self, color: Color) -> Option<bool>
This gives back true or false for text foreground
where true means light and false means a dark text-color
providing good contrast to the given background.
This converts RGB to grayscale and takes the grayscale value of VGA cyan as threshold, which is about 105 out of 255. This point is a bit arbitrary, just based on what I perceive as acceptable. But it produces a good reading contrast in my experience.
For the named colors it takes the VGA equivalent as a base. For indexed colors it splits the range in half as an estimate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scheme
impl RefUnwindSafe for Scheme
impl Send for Scheme
impl Sync for Scheme
impl Unpin for Scheme
impl UnwindSafe for Scheme
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more