Improve color fudging
Prevent fudged colors from ever being pure black. Distribute fudged colors between normal and bold if COLORS is 8. Fudge colors before checking if it's a pre-allocated pair.weechat-hashes
parent
218bfbac32
commit
b9a6d35b65
6
ui.c
6
ui.c
|
@ -133,13 +133,15 @@ static void colorInit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static attr_t colorAttr(short fg) {
|
static attr_t colorAttr(short fg) {
|
||||||
return (fg >= COLORS && fg < 16 ? A_BOLD : A_NORMAL);
|
if (fg != COLOR_BLACK && fg % COLORS == COLOR_BLACK) return A_BOLD;
|
||||||
|
if (COLORS > 8) return A_NORMAL;
|
||||||
|
return (fg / COLORS & 1 ? A_BOLD : A_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static short colorPair(short fg, short bg) {
|
static short colorPair(short fg, short bg) {
|
||||||
if (bg == -1 && fg < 16) return 1 + fg;
|
|
||||||
fg %= COLORS;
|
fg %= COLORS;
|
||||||
bg %= COLORS;
|
bg %= COLORS;
|
||||||
|
if (bg == -1 && fg < 16) return 1 + fg;
|
||||||
for (short pair = 17; pair < colorPairs; ++pair) {
|
for (short pair = 17; pair < colorPairs; ++pair) {
|
||||||
short f, b;
|
short f, b;
|
||||||
pair_content(pair, &f, &b);
|
pair_content(pair, &f, &b);
|
||||||
|
|
Loading…
Reference in New Issue