pub struct ProphotoRgb {
pub red: f64,
pub green: f64,
pub blue: f64,
pub alpha: f32,
}Expand description
A colour in the ProPhoto RGB colour space (ROMM RGB). The components are:
- Red - a number between 0.0 and 1.0
- Green - a number between 0.0 and 1.0
- Blue - a number between 0.0 and 1.0
- Alpha - a number between 0.0 and 100.0
Fields§
§red: f64§green: f64§blue: f64§alpha: f32Implementations§
Trait Implementations§
Source§impl Clone for ProphotoRgb
impl Clone for ProphotoRgb
Source§fn clone(&self) -> ProphotoRgb
fn clone(&self) -> ProphotoRgb
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, U> ColorMix<T, U> for ProphotoRgb
impl<T, U> ColorMix<T, U> for ProphotoRgb
Source§impl Debug for ProphotoRgb
impl Debug for ProphotoRgb
Source§impl Display for ProphotoRgb
impl Display for ProphotoRgb
Source§impl From<A98Rgb> for ProphotoRgb
impl From<A98Rgb> for ProphotoRgb
Source§impl From<Color> for ProphotoRgb
impl From<Color> for ProphotoRgb
Source§impl From<DisplayP3> for ProphotoRgb
impl From<DisplayP3> for ProphotoRgb
Source§impl From<Hex> for ProphotoRgb
impl From<Hex> for ProphotoRgb
Source§impl From<Hsl> for ProphotoRgb
impl From<Hsl> for ProphotoRgb
Source§impl From<Hsv> for ProphotoRgb
impl From<Hsv> for ProphotoRgb
Source§impl From<Hwb> for ProphotoRgb
impl From<Hwb> for ProphotoRgb
Source§impl From<Lab> for ProphotoRgb
impl From<Lab> for ProphotoRgb
Source§impl From<Lch> for ProphotoRgb
impl From<Lch> for ProphotoRgb
Source§impl From<LinearRgb> for ProphotoRgb
impl From<LinearRgb> for ProphotoRgb
Source§impl From<Named> for ProphotoRgb
impl From<Named> for ProphotoRgb
Source§impl From<Oklab> for ProphotoRgb
impl From<Oklab> for ProphotoRgb
Source§impl From<Oklch> for ProphotoRgb
impl From<Oklch> for ProphotoRgb
Source§impl From<ProphotoRgb> for A98Rgb
impl From<ProphotoRgb> for A98Rgb
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Color
impl From<ProphotoRgb> for Color
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Hex
impl From<ProphotoRgb> for Hex
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Hsl
impl From<ProphotoRgb> for Hsl
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Hsv
impl From<ProphotoRgb> for Hsv
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Hwb
impl From<ProphotoRgb> for Hwb
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Lab
impl From<ProphotoRgb> for Lab
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Lch
impl From<ProphotoRgb> for Lch
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for LinearRgb
impl From<ProphotoRgb> for LinearRgb
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Oklab
impl From<ProphotoRgb> for Oklab
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Oklch
impl From<ProphotoRgb> for Oklch
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Rec2020
impl From<ProphotoRgb> for Rec2020
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Rgb
impl From<ProphotoRgb> for Rgb
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for RgbColor
impl From<ProphotoRgb> for RgbColor
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for Srgb
impl From<ProphotoRgb> for Srgb
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for XyzD50
impl From<ProphotoRgb> for XyzD50
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<ProphotoRgb> for XyzD65
impl From<ProphotoRgb> for XyzD65
Source§fn from(value: ProphotoRgb) -> Self
fn from(value: ProphotoRgb) -> Self
Converts to this type from the input type.
Source§impl From<Rec2020> for ProphotoRgb
impl From<Rec2020> for ProphotoRgb
Source§impl From<Srgb> for ProphotoRgb
impl From<Srgb> for ProphotoRgb
Source§impl From<XyzD50> for ProphotoRgb
impl From<XyzD50> for ProphotoRgb
Source§impl From<XyzD65> for ProphotoRgb
impl From<XyzD65> for ProphotoRgb
Source§impl Gamut for ProphotoRgb
impl Gamut for ProphotoRgb
Source§fn in_gamut(&self) -> bool
fn in_gamut(&self) -> bool
Returns
true if all colour channels are within the natural bounds of this colour space.
Alpha is not considered — it is always clamped on construction.Source§fn clamp_to_gamut(&self) -> Self
fn clamp_to_gamut(&self) -> Self
Returns a copy with all colour channels naively clamped to the natural bounds. Read more
Source§fn map_to_gamut(self) -> Self
fn map_to_gamut(self) -> Self
Perceptually maps this colour into gamut. Read more
Source§impl PartialEq for ProphotoRgb
impl PartialEq for ProphotoRgb
Source§impl ToAlpha for ProphotoRgb
impl ToAlpha for ProphotoRgb
Source§impl TryFrom<ProphotoRgb> for Named
impl TryFrom<ProphotoRgb> for Named
Source§type Error = ToNamedError
type Error = ToNamedError
The type returned in the event of a conversion error.
impl Copy for ProphotoRgb
impl StructuralPartialEq for ProphotoRgb
Auto Trait Implementations§
impl Freeze for ProphotoRgb
impl RefUnwindSafe for ProphotoRgb
impl Send for ProphotoRgb
impl Sync for ProphotoRgb
impl Unpin for ProphotoRgb
impl UnwindSafe for ProphotoRgb
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C, T> ColorDistance<T> for C
impl<C, T> ColorDistance<T> for C
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Set the foreground color generically Read more
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Set the background color generically. Read more
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to magenta
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Change the foreground color to the terminal default
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Change the background color to the terminal default
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Change the foreground color to bright black
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Change the background color to bright black
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Change the foreground color to bright red
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Change the background color to bright red
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Change the foreground color to bright green
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Change the background color to bright green
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Change the foreground color to bright yellow
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Change the background color to bright yellow
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Change the foreground color to bright blue
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Change the background color to bright blue
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright magenta
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright magenta
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright purple
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright purple
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Change the foreground color to bright cyan
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Change the background color to bright cyan
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Change the foreground color to bright white
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Change the background color to bright white
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Make the text blink (but fast!)
Hide the text
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Cross out the text
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either [
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§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,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either [
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more§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>
Set the foreground color to a specific RGB value.
§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>
Set the background color to a specific RGB value.
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
§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>
Sets the background color to an RGB value.
Source§impl<C, T> WcagColorContrast<T> for C
impl<C, T> WcagColorContrast<T> for C
Source§fn wcag_contrast_ratio(&self, other: T) -> f64
fn wcag_contrast_ratio(&self, other: T) -> f64
Calculate the contrast ratio between
self and other. colors according to WCAG 2.1. Returns a value between
1:1 and 21:1 Read more