diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-17 14:29:12 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-17 14:29:12 +0200 |
commit | 9fff17787b195e53ff0d9ef97b8579b57fc10c85 (patch) | |
tree | a9f8a513bd56ca864753a49a89c5e04c57b00218 /src/ui | |
parent | bbd7c82c7da273408ea965a9db368a35f8236943 (diff) |
Fixed mismatched banner and background
There was an issue with loss of color precision. Saturation dropped to zero when converting to 8-bit RGB.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/color.c | 4 | ||||
-rw-r--r-- | src/ui/color.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/ui/color.c b/src/ui/color.c index 824342ae..9cba322d 100644 --- a/src/ui/color.c +++ b/src/ui/color.c | |||
@@ -522,8 +522,8 @@ iHSLColor setLum_HSLColor(iHSLColor d, float lum) { | |||
522 | } | 522 | } |
523 | 523 | ||
524 | iHSLColor addSatLum_HSLColor(iHSLColor d, float sat, float lum) { | 524 | iHSLColor addSatLum_HSLColor(iHSLColor d, float sat, float lum) { |
525 | d.sat = iClamp(d.sat + sat, 0, 1); | 525 | d.sat = iClamp(d.sat + sat, minSat_HSLColor, 1); |
526 | d.lum = iClamp(d.lum + lum, 0, 1); | 526 | d.lum = iClamp(d.lum + lum, minSat_HSLColor, 1); |
527 | return d; | 527 | return d; |
528 | } | 528 | } |
529 | 529 | ||
diff --git a/src/ui/color.h b/src/ui/color.h index 24f9e713..f46976d7 100644 --- a/src/ui/color.h +++ b/src/ui/color.h | |||
@@ -231,6 +231,8 @@ struct Impl_HSLColor { | |||
231 | float hue, sat, lum, a; | 231 | float hue, sat, lum, a; |
232 | }; | 232 | }; |
233 | 233 | ||
234 | #define minSat_HSLColor 0.013f /* Conversion to 8-bit RGB may result in saturation dropping to zero. */ | ||
235 | |||
234 | iHSLColor hsl_Color (iColor); | 236 | iHSLColor hsl_Color (iColor); |
235 | iColor rgb_HSLColor (iHSLColor); | 237 | iColor rgb_HSLColor (iHSLColor); |
236 | float luma_Color (iColor); | 238 | float luma_Color (iColor); |