Expand description
A color in the sRGB color space.
Fields
r: f32
Red component, 0.0 - 1.0
g: f32
Green component, 0.0 - 1.0
b: f32
Blue component, 0.0 - 1.0
a: f32
Transparency, 0.0 - 1.0
Implementations
impl Color
impl Color
pub const TRANSPARENT: Color = Color{r: 0.0, g: 0.0, b: 0.0, a: 0.0,}
pub const TRANSPARENT: Color = Color{r: 0.0, g: 0.0, b: 0.0, a: 0.0,}
A color with no opacity.
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Color
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Color
Creates a new Color
.
In debug mode, it will panic if the values are not in the correct range: 0.0 - 1.0
pub const fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Color
pub const fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Color
Creates a Color
from its RGBA components.
pub fn from_rgba8(r: u8, g: u8, b: u8, a: f32) -> Color
pub fn from_rgba8(r: u8, g: u8, b: u8, a: f32) -> Color
Creates a Color
from its RGB8 components and an alpha value.
pub fn into_linear(self) -> [f32; 4]
pub fn into_linear(self) -> [f32; 4]
Converts the Color
into its linear values.
Trait Implementations
impl From<Color> for Background
impl From<Color> for Background
fn from(color: Color) -> Background
fn from(color: Color) -> Background
Converts to this type from the input type.
impl From<Color> for Option<Background>
impl From<Color> for Option<Background>
fn from(color: Color) -> Option<Background>
fn from(color: Color) -> Option<Background>
Converts to this type from the input type.
impl Copy for Color
impl StructuralPartialEq for Color
Auto Trait Implementations
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
sourcefn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.