I'm using lighten to change background and found that it actually darkens the color.
Looking into the code and I found that both lighten and darken tries to decrease the Light factor, shouldn't light increase it?
/// Return a new color with the lightness increased by the given factor.
fn lighten(&self, factor: f32) -> Hsla {
// TODO: should use plus instead of minus?
let l = (self.l * 1.0 - factor.clamp(0.0, 1.0)).min(1.0);
Hsla { l, ..*self }
}
/// Return a new color with the darkness increased by the given factor.
fn darken(&self, factor: f32) -> Hsla {
let l = (self.l * 1.0 - factor.clamp(0.0, 1.0)).max(0.0);
Hsla { l, ..*self }
}
I'm using
lighten
to change background and found that it actually darkens the color.Looking into the code and I found that both
lighten
anddarken
tries to decrease theLight
factor, shouldn'tlight
increase it?