ratatui::style

Enum Color

source
pub enum Color {
Show 19 variants Reset, Black, Red, Green, Yellow, Blue, Magenta, Cyan, Gray, DarkGray, LightRed, LightGreen, LightYellow, LightBlue, LightMagenta, LightCyan, White, Rgb(u8, u8, u8), Indexed(u8),
}
Expand description

ANSI Color

All colors from the ANSI color table are supported (though some names are not exactly the same).

Color NameColorForegroundBackground
blackColor::Black3040
redColor::Red3141
greenColor::Green3242
yellowColor::Yellow3343
blueColor::Blue3444
magentaColor::Magenta3545
cyanColor::Cyan3646
gray*Color::Gray3747
darkgray*Color::DarkGray90100
lightredColor::LightRed91101
lightgreenColor::LightGreen92102
lightyellowColor::LightYellow93103
lightblueColor::LightBlue94104
lightmagentaColor::LightMagenta95105
lightcyanColor::LightCyan96106
white*Color::White97107
  • gray is sometimes called white - this is not supported as we use white for bright white
  • gray is sometimes called silver - this is supported
  • darkgray is sometimes called light black or bright black (both are supported)
  • white is sometimes called light white or bright white (both are supported)
  • we support bright and light prefixes for all colors
  • we support - and _ and as separators for all colors
  • we support both gray and grey spellings

From<Color> for Style is implemented by creating a style with the foreground color set to the given color. This allows you to use colors anywhere that accepts Into<Style>.

§Example

use std::str::FromStr;

use ratatui::style::Color;

assert_eq!(Color::from_str("red"), Ok(Color::Red));
assert_eq!("red".parse(), Ok(Color::Red));
assert_eq!("lightred".parse(), Ok(Color::LightRed));
assert_eq!("light red".parse(), Ok(Color::LightRed));
assert_eq!("light-red".parse(), Ok(Color::LightRed));
assert_eq!("light_red".parse(), Ok(Color::LightRed));
assert_eq!("lightRed".parse(), Ok(Color::LightRed));
assert_eq!("bright red".parse(), Ok(Color::LightRed));
assert_eq!("bright-red".parse(), Ok(Color::LightRed));
assert_eq!("silver".parse(), Ok(Color::Gray));
assert_eq!("dark-grey".parse(), Ok(Color::DarkGray));
assert_eq!("dark gray".parse(), Ok(Color::DarkGray));
assert_eq!("light-black".parse(), Ok(Color::DarkGray));
assert_eq!("white".parse(), Ok(Color::White));
assert_eq!("bright white".parse(), Ok(Color::White));

Variants§

§

Reset

Resets the foreground or background color

§

Black

ANSI Color: Black. Foreground: 30, Background: 40

§

Red

ANSI Color: Red. Foreground: 31, Background: 41

§

Green

ANSI Color: Green. Foreground: 32, Background: 42

§

Yellow

ANSI Color: Yellow. Foreground: 33, Background: 43

§

Blue

ANSI Color: Blue. Foreground: 34, Background: 44

§

Magenta

ANSI Color: Magenta. Foreground: 35, Background: 45

§

Cyan

ANSI Color: Cyan. Foreground: 36, Background: 46

§

Gray

ANSI Color: White. Foreground: 37, Background: 47

Note that this is sometimes called silver or white but we use white for bright white

§

DarkGray

ANSI Color: Bright Black. Foreground: 90, Background: 100

Note that this is sometimes called light black or bright black but we use dark gray

§

LightRed

ANSI Color: Bright Red. Foreground: 91, Background: 101

§

LightGreen

ANSI Color: Bright Green. Foreground: 92, Background: 102

§

LightYellow

ANSI Color: Bright Yellow. Foreground: 93, Background: 103

§

LightBlue

ANSI Color: Bright Blue. Foreground: 94, Background: 104

§

LightMagenta

ANSI Color: Bright Magenta. Foreground: 95, Background: 105

§

LightCyan

ANSI Color: Bright Cyan. Foreground: 96, Background: 106

§

White

ANSI Color: Bright White. Foreground: 97, Background: 107 Sometimes called bright white or light white in some terminals

§

Rgb(u8, u8, u8)

An RGB color.

Note that only terminals that support 24-bit true color will display this correctly. Notably versions of Windows Terminal prior to Windows 10 and macOS Terminal.app do not support this.

If the terminal does not support true color, code using the TermwizBackend will fallback to the default text color. Crossterm and Termion do not have this capability and the display will be unpredictable (e.g. Terminal.app may display glitched blinking text). See https://github.com/ratatui/ratatui/issues/475 for an example of this problem.

See also: https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit

§

Indexed(u8)

Implementations§

source§

impl Color

source

pub const fn from_u32(u: u32) -> Self

Convert a u32 to a Color

The u32 should be in the format 0x00RRGGBB.

source§

impl Color

source

pub fn from_hsl(hsl: Hsl) -> Self

Available on crate feature palette only.

Converts a HSL representation to a Color::Rgb instance.

The from_hsl function converts the Hue, Saturation and Lightness values to a corresponding Color RGB equivalent.

Hue values should be in the range [-180..180]. Values outside this range are normalized by wrapping.

Saturation and L values should be in the range [0.0..1.0]. Values outside this range are clamped.

Clamping to valid ranges happens before conversion to RGB.

§Examples
use ratatui::{palette::Hsl, style::Color};

// Minimum Lightness is black
let color: Color = Color::from_hsl(Hsl::new(0.0, 0.0, 0.0));
assert_eq!(color, Color::Rgb(0, 0, 0));

// Maximum Lightness is white
let color: Color = Color::from_hsl(Hsl::new(0.0, 0.0, 1.0));
assert_eq!(color, Color::Rgb(255, 255, 255));

// Minimum Saturation is fully desaturated red = gray
let color: Color = Color::from_hsl(Hsl::new(0.0, 0.0, 0.5));
assert_eq!(color, Color::Rgb(128, 128, 128));

// Bright red
let color: Color = Color::from_hsl(Hsl::new(0.0, 1.0, 0.5));
assert_eq!(color, Color::Rgb(255, 0, 0));

// Bright blue
let color: Color = Color::from_hsl(Hsl::new(-120.0, 1.0, 0.5));
assert_eq!(color, Color::Rgb(0, 0, 255));
source

pub fn from_hsluv(hsluv: Hsluv) -> Self

Available on crate feature palette only.

Converts a HSLuv representation to a Color::Rgb instance.

The from_hsluv function converts the Hue, Saturation and Lightness values to a corresponding Color RGB equivalent.

Hue values should be in the range [-180.0..180.0]. Values outside this range are normalized by wrapping.

Saturation and L values should be in the range [0.0..100.0]. Values outside this range are clamped.

Clamping to valid ranges happens before conversion to RGB.

§Examples
use ratatui::{palette::Hsluv, style::Color};

// Minimum Lightness is black
let color: Color = Color::from_hsluv(Hsluv::new(0.0, 100.0, 0.0));
assert_eq!(color, Color::Rgb(0, 0, 0));

// Maximum Lightness is white
let color: Color = Color::from_hsluv(Hsluv::new(0.0, 0.0, 100.0));
assert_eq!(color, Color::Rgb(255, 255, 255));

// Minimum Saturation is fully desaturated red = gray
let color = Color::from_hsluv(Hsluv::new(0.0, 0.0, 50.0));
assert_eq!(color, Color::Rgb(119, 119, 119));

// Bright Red
let color = Color::from_hsluv(Hsluv::new(12.18, 100.0, 53.2));
assert_eq!(color, Color::Rgb(255, 0, 0));

// Bright Blue
let color = Color::from_hsluv(Hsluv::new(-94.13, 100.0, 32.3));
assert_eq!(color, Color::Rgb(0, 0, 255));

Trait Implementations§

source§

impl Clone for Color

source§

fn clone(&self) -> Color

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Color

source§

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

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

impl Default for Color

source§

fn default() -> Color

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

impl<'de> Deserialize<'de> for Color

Available on crate feature serde only.
source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

This is used to deserialize a value into Color via serde.

This implementation uses the FromStr trait to deserialize strings, so named colours, RGB, and indexed values are able to be deserialized. In addition, values that were produced by the the older serialization implementation of Color are also able to be deserialized.

Prior to v0.26.0, Ratatui would be serialized using a map for indexed and RGB values, for examples in json {"Indexed": 10} and {"Rgb": [255, 0, 255]} respectively. Now they are serialized using the string representation of the index and the RGB hex value, for example in json it would now be "10" and "#FF00FF" respectively.

See the Color documentation for more information on color names.

§Examples
use std::str::FromStr;

use ratatui::style::Color;

#[derive(Debug, serde::Deserialize)]
struct Theme {
    color: Color,
}

let theme: Theme = serde_json::from_str(r#"{"color": "bright-white"}"#)?;
assert_eq!(theme.color, Color::White);

let theme: Theme = serde_json::from_str(r##"{"color": "#00FF00"}"##)?;
assert_eq!(theme.color, Color::Rgb(0, 255, 0));

let theme: Theme = serde_json::from_str(r#"{"color": "42"}"#)?;
assert_eq!(theme.color, Color::Indexed(42));

let err = serde_json::from_str::<Theme>(r#"{"color": "invalid"}"#).unwrap_err();
assert!(err.is_data());
assert_eq!(
    err.to_string(),
    "Failed to parse Colors at line 1 column 20"
);

// Deserializing from the previous serialization implementation
let theme: Theme = serde_json::from_str(r#"{"color": {"Rgb":[255,0,255]}}"#)?;
assert_eq!(theme.color, Color::Rgb(255, 0, 255));

let theme: Theme = serde_json::from_str(r#"{"color": {"Indexed":10}}"#)?;
assert_eq!(theme.color, Color::Indexed(10));
source§

impl Display for Color

source§

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

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

impl From<AnsiColor> for Color

Available on crate feature termwiz only.
source§

fn from(value: AnsiColor) -> Self

Converts to this type from the input type.
source§

impl From<AnsiValue> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(value: AnsiValue) -> Self

Converts to this type from the input type.
source§

impl From<Black> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: Black) -> Self

Converts to this type from the input type.
source§

impl From<Blue> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: Blue) -> Self

Converts to this type from the input type.
source§

impl From<Color> for Color

Available on crate feature crossterm only.
source§

fn from(color: Color) -> Self

Converts to this type from the input type.
source§

impl From<Color> for Color

Available on crate feature crossterm only.
source§

fn from(value: CColor) -> Self

Converts to this type from the input type.
source§

impl From<Color> for ColorAttribute

Available on crate feature termwiz only.
source§

fn from(color: Color) -> Self

Converts to this type from the input type.
source§

impl From<Color> for Style

source§

fn from(color: Color) -> Self

Creates a new Style with the given foreground color.

To specify a foreground and background color, use the from((fg, bg)) constructor.

§Example
use ratatui::style::{Color, Style};

let style = Style::from(Color::Red);
source§

impl From<ColorAttribute> for Color

Available on crate feature termwiz only.
source§

fn from(value: ColorAttribute) -> Self

Converts to this type from the input type.
source§

impl From<ColorSpec> for Color

Available on crate feature termwiz only.
source§

fn from(value: ColorSpec) -> Self

Converts to this type from the input type.
source§

impl From<Cyan> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: Cyan) -> Self

Converts to this type from the input type.
source§

impl From<Green> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: Green) -> Self

Converts to this type from the input type.
source§

impl From<LightBlack> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: LightBlack) -> Self

Converts to this type from the input type.
source§

impl From<LightBlue> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: LightBlue) -> Self

Converts to this type from the input type.
source§

impl From<LightCyan> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: LightCyan) -> Self

Converts to this type from the input type.
source§

impl From<LightGreen> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: LightGreen) -> Self

Converts to this type from the input type.
source§

impl From<LightMagenta> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: LightMagenta) -> Self

Converts to this type from the input type.
source§

impl From<LightRed> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: LightRed) -> Self

Converts to this type from the input type.
source§

impl From<LightWhite> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: LightWhite) -> Self

Converts to this type from the input type.
source§

impl From<LightYellow> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: LightYellow) -> Self

Converts to this type from the input type.
source§

impl From<LinearRgba> for Color

Available on crate feature termwiz only.
source§

fn from(value: LinearRgba) -> Self

Converts to this type from the input type.
source§

impl From<Magenta> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: Magenta) -> Self

Converts to this type from the input type.
source§

impl From<Red> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: Red) -> Self

Converts to this type from the input type.
source§

impl From<Reset> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: Reset) -> Self

Converts to this type from the input type.
source§

impl<T> From<Rgb<Linear<Srgb>, T>> for Color

Available on crate feature palette only.

Convert a palette::LinSrgb color to a Color.

Note: this conversion only works for floating point linear sRGB colors. If you have a linear sRGB color in another format, you need to convert it to floating point first.

§Examples

use palette::LinSrgb;
use ratatui::style::Color;

let color = Color::from(LinSrgb::new(1.0f32, 0.0, 0.0));
assert_eq!(color, Color::Rgb(255, 0, 0));
source§

fn from(color: LinSrgb<T>) -> Self

Converts to this type from the input type.
source§

impl<T: IntoStimulus<u8>> From<Rgb<Srgb, T>> for Color

Available on crate feature palette only.

Convert an palette::Srgb color to a Color.

§Examples

use palette::Srgb;
use ratatui::style::Color;

let color = Color::from(Srgb::new(1.0f32, 0.0, 0.0));
assert_eq!(color, Color::Rgb(255, 0, 0));
source§

fn from(color: Srgb<T>) -> Self

Converts to this type from the input type.
source§

impl From<Rgb> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(value: Rgb) -> Self

Converts to this type from the input type.
source§

impl From<RgbColor> for Color

Available on crate feature termwiz only.
source§

fn from(value: RgbColor) -> Self

Converts to this type from the input type.
source§

impl From<SrgbaTuple> for Color

Available on crate feature termwiz only.
source§

fn from(value: SrgbaTuple) -> Self

Converts to this type from the input type.
source§

impl From<White> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: White) -> Self

Converts to this type from the input type.
source§

impl From<Yellow> for Color

Available on non-Windows and crate feature termion only.
source§

fn from(_: Yellow) -> Self

Converts to this type from the input type.
source§

impl FromStr for Color

Converts a string representation to a Color instance.

The from_str function attempts to parse the given string and convert it to the corresponding Color variant. It supports named colors, RGB values, and indexed colors. If the string cannot be parsed, a ParseColorError is returned.

See the Color documentation for more information on the supported color names.

§Examples

use std::str::FromStr;

use ratatui::style::Color;

let color: Color = Color::from_str("blue").unwrap();
assert_eq!(color, Color::Blue);

let color: Color = Color::from_str("#FF0000").unwrap();
assert_eq!(color, Color::Rgb(255, 0, 0));

let color: Color = Color::from_str("10").unwrap();
assert_eq!(color, Color::Indexed(10));

let color: Result<Color, _> = Color::from_str("invalid_color");
assert!(color.is_err());
source§

type Err = ParseColorError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for Color

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Color

source§

fn eq(&self, other: &Color) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Color

Available on crate feature serde only.
source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

This utilises the fmt::Display implementation for serialization.

source§

impl Copy for Color

source§

impl Eq for Color

source§

impl StructuralPartialEq for Color

Auto Trait Implementations§

§

impl Freeze for Color

§

impl RefUnwindSafe for Color

§

impl Send for Color

§

impl Sync for Color

§

impl Unpin for Color

§

impl UnwindSafe for Color

Blanket Implementations§

source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where 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) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
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, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
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> FromAngle<T> for T

source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
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, U> IntoAngle<U> for T
where U: FromAngle<T>,

source§

fn into_angle(self) -> U

Performs a conversion into T.
source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
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> IntoStimulus<T> for T

source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToCompactString for T
where T: Display,

source§

impl<T> ToLine for T
where T: Display,

source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
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> ToSpan for T
where T: Display,

source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T> ToText for T
where T: Display,

source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. 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.
source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,