pub enum Color {
}Expand description
ANSI Color
All colors from the ANSI color table are supported (though some names are not exactly the same).
| Color Name | Color | Foreground | Background |
|---|---|---|---|
black | Color::Black | 30 | 40 |
red | Color::Red | 31 | 41 |
green | Color::Green | 32 | 42 |
yellow | Color::Yellow | 33 | 43 |
blue | Color::Blue | 34 | 44 |
magenta | Color::Magenta | 35 | 45 |
cyan | Color::Cyan | 36 | 46 |
gray* | Color::Gray | 37 | 47 |
darkgray* | Color::DarkGray | 90 | 100 |
lightred | Color::LightRed | 91 | 101 |
lightgreen | Color::LightGreen | 92 | 102 |
lightyellow | Color::LightYellow | 93 | 103 |
lightblue | Color::LightBlue | 94 | 104 |
lightmagenta | Color::LightMagenta | 95 | 105 |
lightcyan | Color::LightCyan | 96 | 106 |
white* | Color::White | 97 | 107 |
grayis sometimes calledwhite- this is not supported as we usewhitefor bright whitegrayis sometimes calledsilver- this is supporteddarkgrayis sometimes calledlight blackorbright black(both are supported)whiteis sometimes calledlight whiteorbright white(both are supported)- we support
brightandlightprefixes for all colors - we support
-and_andas separators for all colors - we support both
grayandgreyspellings
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_core::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)
An 8-bit 256 color.
See also https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
Implementations§
Source§impl Color
impl Color
Sourcepub fn from_hsl(hsl: Hsl) -> Color
pub fn from_hsl(hsl: Hsl) -> Color
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 palette::Hsl;
use ratatui_core::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));Sourcepub fn from_hsluv(hsluv: Hsluv) -> Color
pub fn from_hsluv(hsluv: Hsluv) -> Color
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 palette::Hsluv;
use ratatui_core::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<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Color, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Color, <D as Deserializer<'de>>::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_core::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<T> From<Rgb<Linear<Srgb>, T>> for Colorwhere
T: IntoStimulus<u8> + Real + Powf + MulSub + Arithmetics + PartialCmp + Clone,
<T as HasBoolMask>::Mask: LazySelect<T>,
Convert a palette::LinSrgb color to a Color.
impl<T> From<Rgb<Linear<Srgb>, T>> for Colorwhere
T: IntoStimulus<u8> + Real + Powf + MulSub + Arithmetics + PartialCmp + Clone,
<T as HasBoolMask>::Mask: LazySelect<T>,
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_core::style::Color;
let color = Color::from(LinSrgb::new(1.0f32, 0.0, 0.0));
assert_eq!(color, Color::Rgb(255, 0, 0));Source§impl<T> From<Rgb<Srgb, T>> for Colorwhere
T: IntoStimulus<u8>,
Convert an palette::Srgb color to a Color.
impl<T> From<Rgb<Srgb, T>> for Colorwhere
T: IntoStimulus<u8>,
Convert an palette::Srgb color to a Color.
§Examples
use palette::Srgb;
use ratatui_core::style::Color;
let color = Color::from(Srgb::new(1.0f32, 0.0, 0.0));
assert_eq!(color, Color::Rgb(255, 0, 0));Source§impl FromCrossterm<Color> for Color
impl FromCrossterm<Color> for Color
Source§fn from_crossterm(value: Color) -> Color
fn from_crossterm(value: Color) -> Color
Source§impl FromStr for Color
Converts a string representation to a Color instance.
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_core::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§impl FromTermion<AnsiValue> for Color
impl FromTermion<AnsiValue> for Color
Source§fn from_termion(value: AnsiValue) -> Color
fn from_termion(value: AnsiValue) -> Color
Source§impl FromTermion<Black> for Color
impl FromTermion<Black> for Color
Source§fn from_termion(_: Black) -> Color
fn from_termion(_: Black) -> Color
Source§impl FromTermion<Blue> for Color
impl FromTermion<Blue> for Color
Source§fn from_termion(_: Blue) -> Color
fn from_termion(_: Blue) -> Color
Source§impl FromTermion<Cyan> for Color
impl FromTermion<Cyan> for Color
Source§fn from_termion(_: Cyan) -> Color
fn from_termion(_: Cyan) -> Color
Source§impl FromTermion<Green> for Color
impl FromTermion<Green> for Color
Source§fn from_termion(_: Green) -> Color
fn from_termion(_: Green) -> Color
Source§impl FromTermion<LightBlack> for Color
impl FromTermion<LightBlack> for Color
Source§fn from_termion(_: LightBlack) -> Color
fn from_termion(_: LightBlack) -> Color
Source§impl FromTermion<LightBlue> for Color
impl FromTermion<LightBlue> for Color
Source§fn from_termion(_: LightBlue) -> Color
fn from_termion(_: LightBlue) -> Color
Source§impl FromTermion<LightCyan> for Color
impl FromTermion<LightCyan> for Color
Source§fn from_termion(_: LightCyan) -> Color
fn from_termion(_: LightCyan) -> Color
Source§impl FromTermion<LightGreen> for Color
impl FromTermion<LightGreen> for Color
Source§fn from_termion(_: LightGreen) -> Color
fn from_termion(_: LightGreen) -> Color
Source§impl FromTermion<LightMagenta> for Color
impl FromTermion<LightMagenta> for Color
Source§fn from_termion(_: LightMagenta) -> Color
fn from_termion(_: LightMagenta) -> Color
Source§impl FromTermion<LightRed> for Color
impl FromTermion<LightRed> for Color
Source§fn from_termion(_: LightRed) -> Color
fn from_termion(_: LightRed) -> Color
Source§impl FromTermion<LightWhite> for Color
impl FromTermion<LightWhite> for Color
Source§fn from_termion(_: LightWhite) -> Color
fn from_termion(_: LightWhite) -> Color
Source§impl FromTermion<LightYellow> for Color
impl FromTermion<LightYellow> for Color
Source§fn from_termion(_: LightYellow) -> Color
fn from_termion(_: LightYellow) -> Color
Source§impl FromTermion<Magenta> for Color
impl FromTermion<Magenta> for Color
Source§fn from_termion(_: Magenta) -> Color
fn from_termion(_: Magenta) -> Color
Source§impl FromTermion<Red> for Color
impl FromTermion<Red> for Color
Source§fn from_termion(_: Red) -> Color
fn from_termion(_: Red) -> Color
Source§impl FromTermion<Reset> for Color
impl FromTermion<Reset> for Color
Source§fn from_termion(_: Reset) -> Color
fn from_termion(_: Reset) -> Color
Source§impl FromTermion<Rgb> for Color
impl FromTermion<Rgb> for Color
Source§fn from_termion(value: Rgb) -> Color
fn from_termion(value: Rgb) -> Color
Source§impl FromTermion<White> for Color
impl FromTermion<White> for Color
Source§fn from_termion(_: White) -> Color
fn from_termion(_: White) -> Color
Source§impl FromTermion<Yellow> for Color
impl FromTermion<Yellow> for Color
Source§fn from_termion(_: Yellow) -> Color
fn from_termion(_: Yellow) -> Color
Source§impl FromTermwiz<AnsiColor> for Color
impl FromTermwiz<AnsiColor> for Color
Source§fn from_termwiz(value: AnsiColor) -> Color
fn from_termwiz(value: AnsiColor) -> Color
Source§impl FromTermwiz<ColorAttribute> for Color
impl FromTermwiz<ColorAttribute> for Color
Source§fn from_termwiz(value: ColorAttribute) -> Color
fn from_termwiz(value: ColorAttribute) -> Color
Source§impl FromTermwiz<ColorSpec> for Color
impl FromTermwiz<ColorSpec> for Color
Source§fn from_termwiz(value: ColorSpec) -> Color
fn from_termwiz(value: ColorSpec) -> Color
Source§impl FromTermwiz<LinearRgba> for Color
impl FromTermwiz<LinearRgba> for Color
Source§fn from_termwiz(value: LinearRgba) -> Color
fn from_termwiz(value: LinearRgba) -> Color
Source§impl FromTermwiz<RgbColor> for Color
impl FromTermwiz<RgbColor> for Color
Source§fn from_termwiz(value: RgbColor) -> Color
fn from_termwiz(value: RgbColor) -> Color
Source§impl FromTermwiz<SrgbaTuple> for Color
impl FromTermwiz<SrgbaTuple> for Color
Source§fn from_termwiz(value: SrgbaTuple) -> Color
fn from_termwiz(value: SrgbaTuple) -> Color
Source§impl IntoCrossterm<Color> for Color
impl IntoCrossterm<Color> for Color
Source§fn into_crossterm(self) -> Color
fn into_crossterm(self) -> Color
Source§impl IntoTermwiz<ColorAttribute> for Color
impl IntoTermwiz<ColorAttribute> for Color
Source§fn into_termwiz(self) -> ColorAttribute
fn into_termwiz(self) -> ColorAttribute
Source§impl Serialize for Color
impl Serialize for Color
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
This utilises the fmt::Display implementation for serialization.
impl Copy for Color
impl Eq for Color
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 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§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