Skip to main content

scale

Function scale 

Source
const fn scale(value: u8, brightness_percent: u8) -> u8
Expand description

Scale value by brightness_percent (0–100), rounding to nearest.

Computes value × percent / 100 with half-up rounding by adding 50 before the integer division. The intermediate value fits in [u16] because 255 × 100 + 50 = 25 550 < 65 535; neither saturating path can trigger.