[−][src]Struct cssparser::RGBA
A color with red, green, blue, and alpha components, in a byte each.
Fields
red: u8
The red component.
green: u8
The green component.
blue: u8
The blue component.
alpha: u8
The alpha component.
Methods
impl RGBA
[src]
pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Self
[src]
Constructs a new RGBA value from float components. It expects the red, green, blue and alpha channels in that order, and all values will be clamped to the 0.0 ... 1.0 range.
pub fn transparent() -> Self
[src]
Returns a transparent color.
pub fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
[src]
Same thing, but with u8
values instead of floats in the 0 to 1 range.
pub fn red_f32(&self) -> f32
[src]
Returns the red channel in a floating point number form, from 0 to 1.
pub fn green_f32(&self) -> f32
[src]
Returns the green channel in a floating point number form, from 0 to 1.
pub fn blue_f32(&self) -> f32
[src]
Returns the blue channel in a floating point number form, from 0 to 1.
pub fn alpha_f32(&self) -> f32
[src]
Returns the alpha channel in a floating point number form, from 0 to 1.
Trait Implementations
impl ToCss for RGBA
[src]
fn to_css<W>(&self, dest: &mut W) -> Result where
W: Write,
[src]
W: Write,
fn to_css_string(&self) -> String
[src]
impl Clone for RGBA
[src]
impl Copy for RGBA
[src]
impl PartialEq<RGBA> for RGBA
[src]
impl Debug for RGBA
[src]
Auto Trait Implementations
impl Send for RGBA
impl Sync for RGBA
impl Unpin for RGBA
impl UnwindSafe for RGBA
impl RefUnwindSafe for RGBA
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,