Struct huelib::color::Color [−][src]
pub struct Color { /* fields omitted */ }
Expand description
Struct for setting the color of a light.
Implementations
Creates a new color from space coordinates.
This only changes the color of a light and not the brightness.
Examples
Generate a color and use it in a modifier:
use huelib::{Color, resource::light};
let color = Color::from_space_coordinates(0.1, 0.2);
let modifier = light::StateModifier::new().with_color(color);
Creates a new color from rgb values.
This changes the color and brightness of a light.
Examples
Generate a color and use it in a modifier:
use huelib::{Color, resource::light};
let color = Color::from_rgb(255, 0, 0);
let modifier = light::StateModifier::new().with_color(color);
Creates a new color from a hex value.
The string must begin with a #
followed by either 3 or 6 hexadecimal digits.
This changes the color and brightness of a light.
Examples
Generate a color and use it in a modifier:
use huelib::{Color, resource::light};
let red = Color::from_hex("#FF0000")?;
let modifier = light::StateModifier::new().with_color(red);
Generate a color using the short version:
let color = huelib::Color::from_hex("#02B")?;
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Color
impl UnwindSafe for Color
Blanket Implementations
Mutably borrows from an owned value. Read more