diff --git a/src/lib8.rs b/src/lib8.rs index 6ee343d..60ba524 100644 --- a/src/lib8.rs +++ b/src/lib8.rs @@ -2,6 +2,11 @@ use palette::encoding::srgb::Srgb; use rgb::RGB8; +pub fn scale8(i: u8, scale: u8) -> u8 { + // borrowed from FastLED + (i as u16 * scale as u16).wrapping_shr(8) as u8 +} + pub trait Rgb8Blend { fn saturating_add(self, b: Self) -> Self; }