From: Adam Borowski <kilobyte@angband.pl>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>,
linux-console@vger.kernel.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Adam Borowski <kilobyte@angband.pl>
Subject: [PATCH 4/6] vt: change 256-color palette to match all(?) modern terminals
Date: Wed, 18 Jul 2018 05:03:25 +0200 [thread overview]
Message-ID: <20180718030327.579-4-kilobyte@angband.pl> (raw)
In-Reply-To: <20180718030327.579-1-kilobyte@angband.pl>
Turns out that osso-xterm which I based upon uses something a lot different
from apparently any other terminal -- they all use identical shades, much
brighter than what I copied:
Old: 00 2a 55 7f aa d4
New: 00 5f 87 af d7 ff
This did hardly matter as we immediately shoehorn the colors into only 16
values, but recently 24-bit codes turned from an oddity to something
widespread, thus it's better to handle 256 vs 24-bit consistently.
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
drivers/tty/vt/vt.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 4096093c8cd2..8c61caafdf3c 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -1545,9 +1545,12 @@ static void rgb_from_256(int i, struct rgb *c)
c->g = i&2 ? 0xff : 0x55;
c->b = i&4 ? 0xff : 0x55;
} else if (i < 232) { /* 6x6x6 colour cube. */
- c->r = (i - 16) / 36 * 85 / 2;
- c->g = (i - 16) / 6 % 6 * 85 / 2;
- c->b = (i - 16) % 6 * 85 / 2;
+ int r = (i - 16) / 36;
+ int g = (i - 16) / 6 % 6;
+ int b = (i - 16) % 6;
+ c->r = r ? r * 0x28 + 0x37 : 0;
+ c->g = g ? g * 0x28 + 0x37 : 0;
+ c->b = b ? b * 0x28 + 0x37 : 0;
} else /* Grayscale ramp. */
c->r = c->g = c->b = i * 10 - 2312;
}
--
2.18.0
next prev parent reply other threads:[~2018-07-18 3:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 3:01 [PATCH 0/6] vt: no blinking on console, 256/24-bit color improvements Adam Borowski
2018-07-18 3:03 ` [PATCH 1/6] vt: drop unused struct vt_struct Adam Borowski
2018-07-18 3:03 ` [PATCH 2/6] vt: add console flag "unblinking" Adam Borowski
2018-07-18 3:03 ` [PATCH 3/6] vt: let \e[100m use bright background if unblinking Adam Borowski
2018-07-18 3:03 ` Adam Borowski [this message]
2018-07-18 3:03 ` [PATCH 5/6] vt: compensate for brightening the 256-color palette Adam Borowski
2018-07-18 3:03 ` [PATCH 6/6] vt: support bright backgrounds for \e[48m if unblinking Adam Borowski
2018-07-19 10:47 ` [PATCH 0/6] vt: no blinking on console, 256/24-bit color improvements Alan Cox
2018-07-19 14:28 ` Adam Borowski
2018-07-19 14:34 ` Geert Uytterhoeven
2018-07-21 7:43 ` Greg Kroah-Hartman
2018-07-21 21:38 ` Adam Borowski
2018-07-23 8:53 ` Geert Uytterhoeven
2018-07-23 10:41 ` Adam Borowski
2018-07-23 11:07 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180718030327.579-4-kilobyte@angband.pl \
--to=kilobyte@angband.pl \
--cc=b.zolnierkie@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-console@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).