Add a little bit of depth

This commit is contained in:
2024-02-16 11:49:38 +01:00
parent 08676e6071
commit 4be12b4145
14 changed files with 77 additions and 66 deletions

View File

@@ -99,6 +99,12 @@ func (hsl HSL) Add(hue int, saturation float64, lightness float64) HSL {
return new
}
func (hsl HSL) Darken(percent float64) HSL {
hsl.Lightness = hsl.Lightness * percent
hsl.Saturation = hsl.Saturation * percent
return hsl
}
func (hsl HSL) WithAlpha(alpha float64) HSLA {
return HSLA{hsl.Hue, hsl.Saturation, hsl.Lightness, alpha}
}