pub struct Color { /* private fields */ }Expand description
A color in a color-space with an associated alpha channel.
Implementations§
Source§impl Color
impl Color
Sourcepub fn rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Color
pub fn rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Color
This function returns a new translucent color in the sRGB color space with the given coordinates and alpha channel.
Sourcepub fn rgb(red: u8, green: u8, blue: u8) -> Color
pub fn rgb(red: u8, green: u8, blue: u8) -> Color
This function returns a new opaque color in the sRGB color space with the given coordinates.
Sourcepub fn hexa(hex: u32, alpha: f32) -> Color
pub fn hexa(hex: u32, alpha: f32) -> Color
This function returns a new translucent color in the sRGB color space with the given hex-encoded coordinates.
Sourcepub fn hex(hex: u32) -> Color
pub fn hex(hex: u32) -> Color
This function returns a new opaque color in the sRGB color space with the given hex-encoded coordinates.
Sourcepub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
pub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
This function returns a new translucent color in the sRGB color space with the given coordinates after converting from the alternative HSL representation to RGB.
Sourcepub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color
pub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color
This function returns a new opaque color in the sRGB color space with the given coordinates after converting from the alternative HSL representation to RGB.
Sourcepub fn display_p3_rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Color
pub fn display_p3_rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Color
This function returns a new translucent color in the Display-P3 color space with the given coordinates and alpha channel.
Sourcepub fn display_p3_rgb(red: u8, green: u8, blue: u8) -> Color
pub fn display_p3_rgb(red: u8, green: u8, blue: u8) -> Color
This functions returns a new opaque color in the Display-P3 color space with the given coordinates.
Sourcepub fn transparent() -> Color
pub fn transparent() -> Color
This function returns an unbiased transparent color. Specifically, when blending a non-transparent color with a transparent color, the resulting color will have the same color space and coordinate as the non-transparent color, and only the alpha channel will be blended.
Sourcepub fn mix(self, other: Color, factor: f32) -> Color
pub fn mix(self, other: Color, factor: f32) -> Color
Blends the given color with another color using the given factor (between 0.0 and 1.0).
Sourcepub fn to_display_p3(&self) -> Alpha<Rgb<DisplayP3>, f32>
pub fn to_display_p3(&self) -> Alpha<Rgb<DisplayP3>, f32>
This function converts the color to the Display-P3 color space (if necessary) and returns the result.
Trait Implementations§
Source§impl NamedColor for Color
impl NamedColor for Color
Source§fn aliceblue() -> Color
fn aliceblue() -> Color
aliceblue in the sRGB color space.Source§fn antiquewhite() -> Color
fn antiquewhite() -> Color
antiquewhite in the sRGB color space.Source§fn aquamarine() -> Color
fn aquamarine() -> Color
aquamarine in the sRGB color space.Source§fn blanchedalmond() -> Color
fn blanchedalmond() -> Color
blanchedalmond in the sRGB color space.Source§fn blueviolet() -> Color
fn blueviolet() -> Color
blueviolet in the sRGB color space.Source§fn burlywood() -> Color
fn burlywood() -> Color
burlywood in the sRGB color space.Source§fn cadetblue() -> Color
fn cadetblue() -> Color
cadetblue in the sRGB color space.Source§fn chartreuse() -> Color
fn chartreuse() -> Color
chartreuse in the sRGB color space.Source§fn chocolate() -> Color
fn chocolate() -> Color
chocolate in the sRGB color space.Source§fn cornflowerblue() -> Color
fn cornflowerblue() -> Color
cornflowerblue in the sRGB color space.Source§fn cornsilk() -> Color
fn cornsilk() -> Color
cornsilk in the sRGB color space.Source§fn crimson() -> Color
fn crimson() -> Color
crimson in the sRGB color space.Source§fn darkblue() -> Color
fn darkblue() -> Color
darkblue in the sRGB color space.Source§fn darkcyan() -> Color
fn darkcyan() -> Color
darkcyan in the sRGB color space.Source§fn darkgoldenrod() -> Color
fn darkgoldenrod() -> Color
darkgoldenrod in the sRGB color space.Source§fn darkgray() -> Color
fn darkgray() -> Color
darkgray in the sRGB color space.Source§fn darkgreen() -> Color
fn darkgreen() -> Color
darkgreen in the sRGB color space.Source§fn darkgrey() -> Color
fn darkgrey() -> Color
darkgrey in the sRGB color space.Source§fn darkkhaki() -> Color
fn darkkhaki() -> Color
darkkhaki in the sRGB color space.Source§fn darkmagenta() -> Color
fn darkmagenta() -> Color
darkmagenta in the sRGB color space.Source§fn darkolivegreen() -> Color
fn darkolivegreen() -> Color
darkolivegreen in the sRGB color space.Source§fn darkorange() -> Color
fn darkorange() -> Color
darkorange in the sRGB color space.Source§fn darkorchid() -> Color
fn darkorchid() -> Color
darkorchid in the sRGB color space.Source§fn darkred() -> Color
fn darkred() -> Color
darkred in the sRGB color space.Source§fn darksalmon() -> Color
fn darksalmon() -> Color
darksalmon in the sRGB color space.Source§fn darkseagreen() -> Color
fn darkseagreen() -> Color
darkseagreen in the sRGB color space.Source§fn darkslateblue() -> Color
fn darkslateblue() -> Color
darkslateblue in the sRGB color space.Source§fn darkslategray() -> Color
fn darkslategray() -> Color
darkslategray in the sRGB color space.Source§fn darkslategrey() -> Color
fn darkslategrey() -> Color
darkslategrey in the sRGB color space.Source§fn darkturquoise() -> Color
fn darkturquoise() -> Color
darkturquoise in the sRGB color space.Source§fn darkviolet() -> Color
fn darkviolet() -> Color
darkviolet in the sRGB color space.Source§fn deeppink() -> Color
fn deeppink() -> Color
deeppink in the sRGB color space.Source§fn deepskyblue() -> Color
fn deepskyblue() -> Color
deepskyblue in the sRGB color space.Source§fn dimgray() -> Color
fn dimgray() -> Color
dimgray in the sRGB color space.Source§fn dimgrey() -> Color
fn dimgrey() -> Color
dimgrey in the sRGB color space.Source§fn dodgerblue() -> Color
fn dodgerblue() -> Color
dodgerblue in the sRGB color space.Source§fn firebrick() -> Color
fn firebrick() -> Color
firebrick in the sRGB color space.Source§fn floralwhite() -> Color
fn floralwhite() -> Color
floralwhite in the sRGB color space.Source§fn forestgreen() -> Color
fn forestgreen() -> Color
forestgreen in the sRGB color space.Source§fn fuchsia() -> Color
fn fuchsia() -> Color
fuchsia in the sRGB color space.Source§fn gainsboro() -> Color
fn gainsboro() -> Color
gainsboro in the sRGB color space.Source§fn ghostwhite() -> Color
fn ghostwhite() -> Color
ghostwhite in the sRGB color space.Source§fn goldenrod() -> Color
fn goldenrod() -> Color
goldenrod in the sRGB color space.Source§fn greenyellow() -> Color
fn greenyellow() -> Color
greenyellow in the sRGB color space.Source§fn honeydew() -> Color
fn honeydew() -> Color
honeydew in the sRGB color space.Source§fn hotpink() -> Color
fn hotpink() -> Color
hotpink in the sRGB color space.Source§fn indianred() -> Color
fn indianred() -> Color
indianred in the sRGB color space.Source§fn lavender() -> Color
fn lavender() -> Color
lavender in the sRGB color space.Source§fn lavenderblush() -> Color
fn lavenderblush() -> Color
lavenderblush in the sRGB color space.Source§fn lawngreen() -> Color
fn lawngreen() -> Color
lawngreen in the sRGB color space.Source§fn lemonchiffon() -> Color
fn lemonchiffon() -> Color
lemonchiffon in the sRGB color space.Source§fn lightblue() -> Color
fn lightblue() -> Color
lightblue in the sRGB color space.Source§fn lightcoral() -> Color
fn lightcoral() -> Color
lightcoral in the sRGB color space.Source§fn lightcyan() -> Color
fn lightcyan() -> Color
lightcyan in the sRGB color space.Source§fn lightgoldenrodyellow() -> Color
fn lightgoldenrodyellow() -> Color
lightgoldenrodyellow in the sRGB color space.Source§fn lightgray() -> Color
fn lightgray() -> Color
lightgray in the sRGB color space.Source§fn lightgreen() -> Color
fn lightgreen() -> Color
lightgreen in the sRGB color space.Source§fn lightgrey() -> Color
fn lightgrey() -> Color
lightgrey in the sRGB color space.Source§fn lightpink() -> Color
fn lightpink() -> Color
lightpink in the sRGB color space.Source§fn lightsalmon() -> Color
fn lightsalmon() -> Color
lightsalmon in the sRGB color space.Source§fn lightseagreen() -> Color
fn lightseagreen() -> Color
lightseagreen in the sRGB color space.Source§fn lightskyblue() -> Color
fn lightskyblue() -> Color
lightskyblue in the sRGB color space.Source§fn lightslategray() -> Color
fn lightslategray() -> Color
lightslategray in the sRGB color space.Source§fn lightslategrey() -> Color
fn lightslategrey() -> Color
lightslategrey in the sRGB color space.Source§fn lightsteelblue() -> Color
fn lightsteelblue() -> Color
lightsteelblue in the sRGB color space.Source§fn lightyellow() -> Color
fn lightyellow() -> Color
lightyellow in the sRGB color space.Source§fn limegreen() -> Color
fn limegreen() -> Color
limegreen in the sRGB color space.Source§fn magenta() -> Color
fn magenta() -> Color
magenta in the sRGB color space.Source§fn mediumaquamarine() -> Color
fn mediumaquamarine() -> Color
mediumaquamarine in the sRGB color space.Source§fn mediumblue() -> Color
fn mediumblue() -> Color
mediumblue in the sRGB color space.Source§fn mediumorchid() -> Color
fn mediumorchid() -> Color
mediumorchid in the sRGB color space.Source§fn mediumpurple() -> Color
fn mediumpurple() -> Color
mediumpurple in the sRGB color space.Source§fn mediumseagreen() -> Color
fn mediumseagreen() -> Color
mediumseagreen in the sRGB color space.Source§fn mediumslateblue() -> Color
fn mediumslateblue() -> Color
mediumslateblue in the sRGB color space.Source§fn mediumspringgreen() -> Color
fn mediumspringgreen() -> Color
mediumspringgreen in the sRGB color space.Source§fn mediumturquoise() -> Color
fn mediumturquoise() -> Color
mediumturquoise in the sRGB color space.Source§fn mediumvioletred() -> Color
fn mediumvioletred() -> Color
mediumvioletred in the sRGB color space.Source§fn midnightblue() -> Color
fn midnightblue() -> Color
midnightblue in the sRGB color space.Source§fn mintcream() -> Color
fn mintcream() -> Color
mintcream in the sRGB color space.Source§fn mistyrose() -> Color
fn mistyrose() -> Color
mistyrose in the sRGB color space.Source§fn moccasin() -> Color
fn moccasin() -> Color
moccasin in the sRGB color space.navajowhite in the sRGB color space.navy in the sRGB color space.Source§fn oldlace() -> Color
fn oldlace() -> Color
oldlace in the sRGB color space.Source§fn olivedrab() -> Color
fn olivedrab() -> Color
olivedrab in the sRGB color space.Source§fn orangered() -> Color
fn orangered() -> Color
orangered in the sRGB color space.Source§fn palegoldenrod() -> Color
fn palegoldenrod() -> Color
palegoldenrod in the sRGB color space.Source§fn palegreen() -> Color
fn palegreen() -> Color
palegreen in the sRGB color space.Source§fn paleturquoise() -> Color
fn paleturquoise() -> Color
paleturquoise in the sRGB color space.Source§fn palevioletred() -> Color
fn palevioletred() -> Color
palevioletred in the sRGB color space.Source§fn papayawhip() -> Color
fn papayawhip() -> Color
papayawhip in the sRGB color space.Source§fn peachpuff() -> Color
fn peachpuff() -> Color
peachpuff in the sRGB color space.Source§fn powderblue() -> Color
fn powderblue() -> Color
powderblue in the sRGB color space.Source§fn rebeccapurple() -> Color
fn rebeccapurple() -> Color
rebeccapurple in the sRGB color space.Source§fn rosybrown() -> Color
fn rosybrown() -> Color
rosybrown in the sRGB color space.Source§fn royalblue() -> Color
fn royalblue() -> Color
royalblue in the sRGB color space.Source§fn saddlebrown() -> Color
fn saddlebrown() -> Color
saddlebrown in the sRGB color space.Source§fn sandybrown() -> Color
fn sandybrown() -> Color
sandybrown in the sRGB color space.Source§fn seagreen() -> Color
fn seagreen() -> Color
seagreen in the sRGB color space.Source§fn seashell() -> Color
fn seashell() -> Color
seashell in the sRGB color space.Source§fn skyblue() -> Color
fn skyblue() -> Color
skyblue in the sRGB color space.Source§fn slateblue() -> Color
fn slateblue() -> Color
slateblue in the sRGB color space.Source§fn slategray() -> Color
fn slategray() -> Color
slategray in the sRGB color space.Source§fn slategrey() -> Color
fn slategrey() -> Color
slategrey in the sRGB color space.Source§fn springgreen() -> Color
fn springgreen() -> Color
springgreen in the sRGB color space.Source§fn steelblue() -> Color
fn steelblue() -> Color
steelblue in the sRGB color space.Source§fn thistle() -> Color
fn thistle() -> Color
thistle in the sRGB color space.Source§fn turquoise() -> Color
fn turquoise() -> Color
turquoise in the sRGB color space.Source§fn whitesmoke() -> Color
fn whitesmoke() -> Color
whitesmoke in the sRGB color space.Source§fn yellowgreen() -> Color
fn yellowgreen() -> Color
yellowgreen in the sRGB color space.Source§impl ToTokens for Color
impl ToTokens for Color
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl Copy 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 S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
Source§fn convert_into(self) -> U
fn convert_into(self) -> U
Source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains the unclamped color. Read more