[−][src]Struct duku::Color
Color bytes in RGBA.
Makes it easier to handle/convert colors.
Example
let red = Color::RED; let (h, s, v) = rgb.to_hsv();
Fields
r: u8
the red component
g: u8
the green component
b: u8
the blue component
a: u8
the alpha component
Implementations
impl Color
[src]
pub const fn rgb(r: u8, g: u8, b: u8) -> Self
[src]
Create color from RGB bytes
pub const fn rgba(r: u8, g: u8, b: u8, a: u8) -> Self
[src]
Create color from RGBA bytes
pub fn hsv(h: u16, s: u8, v: u8) -> Self
[src]
Create color from HSV components
pub fn rgb_norm(r: f32, g: f32, b: f32) -> Self
[src]
Create color from RGB normalized floats
pub fn rgba_norm(r: f32, g: f32, b: f32, a: f32) -> Self
[src]
Create color from RGBA normalized floats
pub const fn gray(v: u8) -> Self
[src]
Create color from gray value byte
pub fn gray_norm(v: f32) -> Self
[src]
Create color from gray value normalized float
pub fn to_rgb_norm(&self) -> [f32; 3]
[src]
Get RGB components as normalized floats
pub fn to_rgba_norm(&self) -> [f32; 4]
[src]
Get RGBA components as normalized floats
pub fn to_hsv(&self) -> (u16, u8, u8)
[src]
Get HSV components
pub fn to_srgb(&self) -> Self
[src]
Convert color to sRGB color space
pub fn to_linear(&self) -> Self
[src]
Convert color to linear color space
pub const WHITE: Self
[src]
Shorthand for Color::rgb(255, 255, 255)
pub const SILVER: Self
[src]
Shorthand for Color::rgb(192, 192, 192)
pub const GRAY: Self
[src]
Shorthand for Color::rgb(128, 128, 128)
pub const BLACK: Self
[src]
Shorthand for Color::rgb(0, 0, 0)
pub const RED: Self
[src]
Shorthand for Color::rgb(255, 0, 0)
pub const MAROON: Self
[src]
Shorthand for Color::rgb(128, 0, 0)
pub const YELLOW: Self
[src]
Shorthand for Color::rgb(255, 255, 0)
pub const OLIVE: Self
[src]
Shorthand for Color::rgb(128, 128, 0)
pub const AQUA: Self
[src]
Shorthand for Color::rgb(0, 255, 255)
pub const TEAL: Self
[src]
Shorthand for Color::rgb(0, 128, 128)
pub const BLUE: Self
[src]
Shorthand for Color::rgb(0, 0, 255)
pub const NAVY: Self
[src]
Shorthand for Color::rgb(0, 0, 128)
pub const FUCHSIA: Self
[src]
Shorthand for Color::rgb(128, 0, 128)
pub const PURPLE: Self
[src]
Shorthand for Color::rgb(128, 0, 128)
pub const GREEN: Self
[src]
Shorthand for Color::rgb(0, 255, 0)
pub const SKY_BLUE: Self
[src]
Shorthand for Color::rgb(135, 206, 235)
pub const ORANGE: Self
[src]
Shorthand for Color::rgb(255, 127, 0)
Trait Implementations
impl Clone for Color
[src]
impl Copy for Color
[src]
impl Debug for Color
[src]
impl Eq for Color
[src]
impl From<[f32; 3]> for Color
[src]
impl From<[f32; 4]> for Color
[src]
impl From<[u8; 3]> for Color
[src]
impl From<[u8; 4]> for Color
[src]
impl From<Color> for Vector3
[src]
impl From<Color> for Vector4
[src]
impl Hash for Color
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Color> for Color
[src]
impl StructuralEq for Color
[src]
impl StructuralPartialEq for Color
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,