@@ -1559,17 +1559,17 @@ static void rgb_foreground(struct vc_data *vc, const struct rgb *c)
{
u8 hue = 0, max = max3(c->r, c->g, c->b);
- if (c->r > max / 2)
+ if (c->r > max / 2 + 32)
hue |= 4;
- if (c->g > max / 2)
+ if (c->g > max / 2 + 32)
hue |= 2;
- if (c->b > max / 2)
+ if (c->b > max / 2 + 32)
hue |= 1;
- if (hue == 7 && max <= 0x55) {
+ if (hue == 7 && max <= 0x70) {
hue = 0;
vc->vc_intensity = 2;
- } else if (max > 0xaa)
+ } else if (max > 0xc0)
vc->vc_intensity = 2;
else
vc->vc_intensity = 1;
The algorithm for 256-to-16 conversion was designed with wrong input palette but actually tuned on mainstream GUI terminals. This resulted in something that works well only for data we convert ourselves (ie, 256 not 24-bit). As the change is non-linear, I did not bother replicating it exactly, thus there are some differences, among others: * values very close to black go to 0 (black) rather than 8 (dark grey) * grayscale ramp is more even A comparison of the old vs new vs FreeBSD's teken is at: https://github.com/kilobyte/colorkernel Signed-off-by: Adam Borowski <kilobyte@angband.pl> --- drivers/tty/vt/vt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)