aboutsummaryrefslogtreecommitdiff
path: root/osc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-02 21:07:26 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-02 21:07:26 +0000
commitae7383189a33c9744ab770a299d74a1559366706 (patch)
treecc640dc5a79f0d00c55b104b7a1899e295352c57 /osc.c
parentosc: OSC 12: mimic xterm - a color value of 0 means use inverted fg/bg (diff)
osc: fix scaling of RGB formatted color specifiers
Diffstat (limited to 'osc.c')
-rw-r--r--osc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/osc.c b/osc.c
index e40ee6a3..d28fd057 100644
--- a/osc.c
+++ b/osc.c
@@ -291,9 +291,9 @@ parse_rgb(const char *string, uint32_t *color)
}
/* Re-scale to 8-bit */
- uint8_t r = 255 * (rgb[0] / (double)((1 << (4 * digits[0])) - 1));
- uint8_t g = 255 * (rgb[1] / (double)((1 << (4 * digits[1])) - 1));
- uint8_t b = 255 * (rgb[2] / (double)((1 << (4 * digits[2])) - 1));
+ uint8_t r = 256 * (rgb[0] / (double)(1 << (4 * digits[0])));
+ uint8_t g = 256 * (rgb[1] / (double)(1 << (4 * digits[1])));
+ uint8_t b = 256 * (rgb[2] / (double)(1 << (4 * digits[2])));
LOG_DBG("rgb: %02x%02x%02x", r, g, b);
*color = r << 16 | g << 8 | b;