[][src]Struct sensehat_screen::color::PixelColor

pub struct PixelColor {
    pub red: u8,
    pub green: u8,
    pub blue: u8,
}

24-bit RGB color pixel.

This is the fundamental representation for RGB colors.

Fields

red: u8green: u8blue: u8

Implementations

impl PixelColor[src]

pub const BLACK: PixelColor[src]

pub const RED: PixelColor[src]

pub const BLUE: PixelColor[src]

pub const GREEN: PixelColor[src]

pub const WHITE: PixelColor[src]

pub const YELLOW: PixelColor[src]

pub const CYAN: PixelColor[src]

pub const MAGENTA: PixelColor[src]

pub fn new(red: u8, green: u8, blue: u8) -> Self[src]

Create a new LED pixel color.

pub fn from_rgb565_bytes(color: [u8; 2]) -> Self[src]

Create a new LED pixel color from a pair of RGB565-encoded bytes.

pub fn rgb565(&self) -> [u8; 2][src]

Encodes the current LED pixel color into a pair of RGB565-encoded bytes.

pub fn dim(self, mut scale: f32) -> PixelColor[src]

Sets the brightness of this colour.

The scale value should be between 0 and 1. Values outside this range are clamped.

Trait Implementations

impl Clone for PixelColor[src]

impl Copy for PixelColor[src]

impl Debug for PixelColor[src]

impl Default for PixelColor[src]

impl<'de> Deserialize<'de> for PixelColor[src]

impl<'a> From<&'a PixelColor> for Rgb565[src]

impl From<(u8, u8, u8)> for PixelColor[src]

impl From<PixelColor> for Rgb565[src]

impl From<Rgb565> for PixelColor[src]

impl Into<(u8, u8, u8)> for PixelColor[src]

impl PartialEq<PixelColor> for PixelColor[src]

impl Serialize for PixelColor[src]

impl StructuralPartialEq for PixelColor[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.