diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-05-02 21:07:26 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-05-02 21:07:26 +0000 |
| commit | ae7383189a33c9744ab770a299d74a1559366706 (patch) | |
| tree | cc640dc5a79f0d00c55b104b7a1899e295352c57 | |
| parent | osc: OSC 12: mimic xterm - a color value of 0 means use inverted fg/bg (diff) | |
osc: fix scaling of RGB formatted color specifiers
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | osc.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c1920c89..fa61f3ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,7 +63,7 @@ * Trackpad sloooow scrolling to eventually scroll a line. * Memory leak in terminal reset. * Translation of cursor coordinates on resize -* Scaling of legacy formatted color specifiers in OSC sequences. +* Scaling color specifiers in OSC sequences. * `OSC 12 ?` to return the cursor color, not the cursor's text color. * `OSC 12;#000000` to configure the cursor to use inverted foreground/background colors. @@ -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; |
