forked from wathiede/i3xs
16 lines
460 B
Rust
16 lines
460 B
Rust
use i3monkit::ColorRGB;
|
|
|
|
pub const WHITE: ColorRGB = ColorRGB(255, 255, 255);
|
|
|
|
pub fn lerp(c1: ColorRGB, c2: ColorRGB, alpha: f32) -> ColorRGB {
|
|
ColorRGB(
|
|
(c1.0 as f32 * (1. - alpha) + c2.0 as f32 * alpha) as u8,
|
|
(c1.1 as f32 * (1. - alpha) + c2.1 as f32 * alpha) as u8,
|
|
(c1.2 as f32 * (1. - alpha) + c2.2 as f32 * alpha) as u8,
|
|
)
|
|
}
|
|
|
|
pub fn to_string(c: ColorRGB) -> String {
|
|
format!("#{:02x}{:02x}{:02x}", c.0, c.1, c.2)
|
|
}
|