pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
}Expand description
A color represented as RGB components. All values are compile-time constants with zero runtime cost.
Ordering is lexicographic by (r, g, b).
Fields§
§r: u8Red component (0–255).
g: u8Green component (0–255).
b: u8Blue component (0–255).
Implementations§
Source§impl Color
impl Color
Sourcepub const fn new(r: u8, g: u8, b: u8) -> Self
pub const fn new(r: u8, g: u8, b: u8) -> Self
Construct a Color from RGB components.
§Examples
use chromata::Color;
let red = Color::new(255, 0, 0);
assert_eq!(red.r, 255);
assert_eq!(red.g, 0);Sourcepub const fn from_hex(hex: u32) -> Self
pub const fn from_hex(hex: u32) -> Self
Construct a Color from a 24-bit hex value (0xRRGGBB).
§Examples
use chromata::Color;
let c = Color::from_hex(0x1d2021);
assert_eq!(c.r, 0x1d);
assert_eq!(c.g, 0x20);
assert_eq!(c.b, 0x21);Sourcepub const fn from_css_hex(s: &str) -> Option<Color>
pub const fn from_css_hex(s: &str) -> Option<Color>
Construct a Color by parsing a CSS hex string.
Accepts 6-digit ("#1d2021", "1d2021") and 3-digit shorthand
("#FFF", "FFF") formats. The 3-digit form expands each digit
(e.g., #ABC becomes #AABBCC).
Returns None if the string is not a valid hex color.
§Examples
use chromata::Color;
let c = Color::from_css_hex("#1d2021").unwrap();
assert_eq!(c, Color::from_hex(0x1d2021));
let c = Color::from_css_hex("1d2021").unwrap();
assert_eq!(c, Color::from_hex(0x1d2021));
let c = Color::from_css_hex("#FFF").unwrap();
assert_eq!(c, Color::new(255, 255, 255));
assert!(Color::from_css_hex("nope").is_none());Sourcepub const fn to_hex(self) -> u32
pub const fn to_hex(self) -> u32
Return the color as a 24-bit hex value.
§Examples
use chromata::Color;
let c = Color::new(0x1d, 0x20, 0x21);
assert_eq!(c.to_hex(), 0x1d2021);Sourcepub fn to_css_hex(self) -> String
pub fn to_css_hex(self) -> String
Return the color as a CSS hex string like “#1d2021”.
§Examples
use chromata::Color;
let c = Color::from_hex(0x1d2021);
assert_eq!(c.to_css_hex(), "#1d2021");Sourcepub const fn to_f32(self) -> (f32, f32, f32)
pub const fn to_f32(self) -> (f32, f32, f32)
Convert to an (f32, f32, f32) tuple in [0.0, 1.0] range.
§Examples
use chromata::Color;
let white = Color::new(255, 255, 255);
let (r, g, b) = white.to_f32();
assert!((r - 1.0).abs() < f32::EPSILON);Sourcepub fn from_f32(r: f32, g: f32, b: f32) -> Self
pub fn from_f32(r: f32, g: f32, b: f32) -> Self
Construct a Color from normalized [0.0, 1.0] RGB components.
Values are clamped to [0.0, 1.0] and rounded to the nearest u8.
NaN is treated as 0.0.
§Examples
use chromata::Color;
let c = Color::from_f32(1.0, 0.5, 0.0);
assert_eq!(c, Color::new(255, 128, 0));Sourcepub fn luminance(self) -> f64
pub fn luminance(self) -> f64
Relative luminance per WCAG 2.0.
Returns a value between 0.0 (black) and 1.0 (white).
§Examples
use chromata::Color;
let black = Color::new(0, 0, 0);
let white = Color::new(255, 255, 255);
assert!((black.luminance()).abs() < 0.001);
assert!((white.luminance() - 1.0).abs() < 0.001);Sourcepub fn contrast_ratio(self, other: Color) -> f64
pub fn contrast_ratio(self, other: Color) -> f64
WCAG contrast ratio between two colors.
Returns a value between 1.0 (identical) and 21.0 (black vs white).
§Examples
use chromata::Color;
let black = Color::new(0, 0, 0);
let white = Color::new(255, 255, 255);
let ratio = black.contrast_ratio(white);
assert!(ratio > 20.0); // ~21:1 for black/whiteSourcepub fn lerp(self, other: Color, t: f32) -> Color
pub fn lerp(self, other: Color, t: f32) -> Color
Linear interpolation between two colors.
t is clamped to [0.0, 1.0]. Interpolation is performed in sRGB space.
§Examples
use chromata::Color;
let black = Color::new(0, 0, 0);
let white = Color::new(255, 255, 255);
let mid = black.lerp(white, 0.5);
assert_eq!(mid, Color::new(127, 127, 127));Trait Implementations§
Source§impl Default for Color
Default Color is black (0, 0, 0).
impl Default for Color
Default Color is black (0, 0, 0).
§Examples
use chromata::Color;
assert_eq!(Color::default(), Color::new(0, 0, 0));Source§impl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<[u8; 3]> for Color
Construct a Color from an [r, g, b] array.
impl From<[u8; 3]> for Color
Construct a Color from an [r, g, b] array.
§Examples
use chromata::Color;
let c: Color = [29, 32, 33].into();
assert_eq!(c, Color::new(29, 32, 33));Source§impl From<(u8, u8, u8)> for Color
Construct a Color from an (r, g, b) tuple.
impl From<(u8, u8, u8)> for Color
Construct a Color from an (r, g, b) tuple.
§Examples
use chromata::Color;
let c: Color = (29, 32, 33).into();
assert_eq!(c, Color::new(29, 32, 33));Source§impl From<Color> for [u8; 3]
Extract the [r, g, b] components from a Color.
impl From<Color> for [u8; 3]
Extract the [r, g, b] components from a Color.
§Examples
use chromata::Color;
let arr: [u8; 3] = Color::new(29, 32, 33).into();
assert_eq!(arr, [29, 32, 33]);Source§impl From<Color> for (u8, u8, u8)
Extract the (r, g, b) components from a Color.
impl From<Color> for (u8, u8, u8)
Extract the (r, g, b) components from a Color.
§Examples
use chromata::Color;
let (r, g, b): (u8, u8, u8) = Color::new(29, 32, 33).into();
assert_eq!((r, g, b), (29, 32, 33));Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature colored-integration only.Convert a chromata Color to a colored TrueColor.
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature colored-integration only.Convert a chromata Color to a colored TrueColor.
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature comfy-table-integration only.Convert a chromata Color to a comfy-table RGB color.
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature comfy-table-integration only.Convert a chromata Color to a comfy-table RGB color.
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature crossterm-integration only.Convert a chromata Color to a crossterm RGB color.
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature crossterm-integration only.Convert a chromata Color to a crossterm RGB color.
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature cursive-integration only.Convert a chromata Color to a cursive RGB color.
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature cursive-integration only.Convert a chromata Color to a cursive RGB color.
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature iced-integration only.Convert a chromata Color to an iced RGBA color (alpha = 1.0).
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature iced-integration only.Convert a chromata Color to an iced RGBA color (alpha = 1.0).
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature macroquad-integration only.Convert a chromata Color to a macroquad RGBA color (alpha = 1.0).
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature macroquad-integration only.Convert a chromata Color to a macroquad RGBA color (alpha = 1.0).
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature ratatui-integration only.Convert a chromata Color to a ratatui RGB color.
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature ratatui-integration only.Convert a chromata Color to a ratatui RGB color.
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature slint-integration only.Convert a chromata Color to a Slint RGB color.
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature slint-integration only.Convert a chromata Color to a Slint RGB color.
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature syntect-integration only.Convert a chromata Color to a syntect RGBA color (alpha = 255).
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature syntect-integration only.Convert a chromata Color to a syntect RGBA color (alpha = 255).
Source§impl From<Color> for Color
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature wgpu-integration only.Convert a chromata Color to a wgpu RGBA color (alpha = 1.0).
impl From<Color> for Color
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature wgpu-integration only.Convert a chromata Color to a wgpu RGBA color (alpha = 1.0).
Source§impl From<Color> for Color32
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature egui-integration only.Convert a chromata Color to an egui Color32.
impl From<Color> for Color32
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature egui-integration only.Convert a chromata Color to an egui Color32.
Source§impl From<Color> for PremultipliedColorU8
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature tiny-skia-integration only.Convert a chromata Color to a tiny-skia premultiplied RGBA color (alpha = 255).
impl From<Color> for PremultipliedColorU8
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature tiny-skia-integration only.Convert a chromata Color to a tiny-skia premultiplied RGBA color (alpha = 255).
Source§impl From<Color> for RGBColor
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature plotters-integration only.Convert a chromata Color to a plotters RGBColor.
impl From<Color> for RGBColor
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature plotters-integration only.Convert a chromata Color to a plotters RGBColor.
Source§impl From<Color> for Rgb
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature owo-colors-integration only.Convert a chromata Color to an owo-colors Rgb.
impl From<Color> for Rgb
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature owo-colors-integration only.Convert a chromata Color to an owo-colors Rgb.
Source§impl From<Color> for Srgb<u8>
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature palette-integration only.Convert a chromata Color to a palette sRGB color with u8 components.
impl From<Color> for Srgb<u8>
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature palette-integration only.Convert a chromata Color to a palette sRGB color with u8 components.
Source§impl From<Color> for Rgb<u8>
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature image-integration only.Convert a chromata Color to an image Rgb pixel.
impl From<Color> for Rgb<u8>
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature image-integration only.Convert a chromata Color to an image Rgb pixel.
Source§impl From<Color> for Rgb
Available on Unix and crate feature termion-integration and (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) only.Convert a chromata Color to a termion Rgb color.
impl From<Color> for Rgb
termion-integration and (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) only.Convert a chromata Color to a termion Rgb color.
Source§impl From<Color> for Srgba
Available on (crate features bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature bevy-color-integration only.Convert a chromata Color to a Bevy sRGBA color (alpha = 1.0).
impl From<Color> for Srgba
bevy-color-integration or colored-integration or comfy-table-integration or crossterm-integration or cursive-integration or egui-integration or iced-integration or image-integration or macroquad-integration or owo-colors-integration or palette-integration or plotters-integration or ratatui-integration or slint-integration or syntect-integration or termion-integration or tiny-skia-integration or wgpu-integration) and crate feature bevy-color-integration only.Convert a chromata Color to a Bevy sRGBA color (alpha = 1.0).
Source§impl From<Color> for u32
Extract the 24-bit hex value from a Color.
impl From<Color> for u32
Extract the 24-bit hex value from a Color.
§Examples
use chromata::Color;
let v: u32 = Color::from_hex(0x1d2021).into();
assert_eq!(v, 0x1d2021);Source§impl From<u32> for Color
Construct a Color from a 24-bit hex value (0xRRGGBB).
impl From<u32> for Color
Construct a Color from a 24-bit hex value (0xRRGGBB).
Only the lower 24 bits are used; upper bits are silently ignored.
§Examples
use chromata::Color;
let c: Color = 0x1d2021u32.into();
assert_eq!(c, Color::from_hex(0x1d2021));Source§impl FromStr for Color
Parse a CSS hex color string like "#1d2021", "1d2021", "#FFF", or "FFF".
impl FromStr for Color
Parse a CSS hex color string like "#1d2021", "1d2021", "#FFF", or "FFF".
§Examples
use chromata::Color;
let c: Color = "#1d2021".parse().unwrap();
assert_eq!(c, Color::from_hex(0x1d2021));Source§impl Ord for Color
impl Ord for Color
Source§impl PartialOrd for Color
impl PartialOrd for Color
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 UnsafeUnpin 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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for 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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
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> 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 moreSharedString.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