aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-11-15 20:04:21 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-11-15 20:04:21 +0000
commit690cf0ab549937fd5205c0ebbc3c18209302b11a (patch)
treead4d3cb9827597e0b1567b5cf7b3d82118c4c745
parentrender: dim and brighten colors by adjusting luminance (diff)
render: dim/brighten: multiply/divide instead of add/subtract
-rw-r--r--render.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/render.c b/render.c
index bae5da7d..96905c0c 100644
--- a/render.c
+++ b/render.c
@@ -237,7 +237,7 @@ color_dim(uint32_t color)
{
int hue, sat, lum;
rgb_to_hsl(color, &hue, &sat, &lum);
- return hsl_to_rgb(hue, sat, max(0, lum - 15));
+ return hsl_to_rgb(hue, sat, lum / 1.5);
}
static inline uint32_t
@@ -245,7 +245,7 @@ color_brighten(uint32_t color)
{
int hue, sat, lum;
rgb_to_hsl(color, &hue, &sat, &lum);
- return hsl_to_rgb(hue, sat, min(100, lum + 15));
+ return hsl_to_rgb(hue, sat, min(100, lum * 1.3));
}
static inline void