Struct cssparser::RGBA [−][src]
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]
impl RGBA
pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Self
[src]
pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Self
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]
pub fn transparent() -> Self
Returns a transparent color.
pub fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
[src]
pub fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
Same thing, but with u8
values instead of floats in the 0 to 1 range.
pub fn red_f32(&self) -> f32
[src]
pub fn red_f32(&self) -> f32
Returns the red channel in a floating point number form, from 0 to 1.
pub fn green_f32(&self) -> f32
[src]
pub fn green_f32(&self) -> f32
Returns the green channel in a floating point number form, from 0 to 1.
pub fn blue_f32(&self) -> f32
[src]
pub fn blue_f32(&self) -> f32
Returns the blue channel in a floating point number form, from 0 to 1.
pub fn alpha_f32(&self) -> f32
[src]
pub fn alpha_f32(&self) -> f32
Returns the alpha channel in a floating point number form, from 0 to 1.
Trait Implementations
impl Clone for RGBA
[src]
impl Clone for RGBA
fn clone(&self) -> RGBA
[src]
fn clone(&self) -> RGBA
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for RGBA
[src]
impl Copy for RGBA
impl PartialEq for RGBA
[src]
impl PartialEq for RGBA
fn eq(&self, other: &RGBA) -> bool
[src]
fn eq(&self, other: &RGBA) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &RGBA) -> bool
[src]
fn ne(&self, other: &RGBA) -> bool
This method tests for !=
.
impl Debug for RGBA
[src]
impl Debug for RGBA
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl ToCss for RGBA
[src]
impl ToCss for RGBA