diff options
author | C. McEnroe | 2020-02-05 04:24:13 -0500 |
---|---|---|
committer | C. McEnroe | 2020-02-05 04:24:13 -0500 |
commit | 6e679bdf26fa4dae651aade985155bd424761a3a (patch) | |
tree | 92eb50e7ec420e7431144e6e5246a52a5aa5344f /ui.c | |
parent | 1cf6e29fc465dc9e3633950ede758d4fd1eb644d (diff) |
Modulo colors before comparing pairs
Otherwise a new pair is allocated every time a high color is requested.
Diffstat (limited to 'ui.c')
-rw-r--r-- | ui.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ui.c b/ui.c index 12205cc..894e04d 100644 --- a/ui.c +++ b/ui.c @@ -135,12 +135,14 @@ static attr_t colorAttr(short fg) { static short colorPair(short fg, short bg) { if (bg == -1) return 1 + fg; + fg %= COLORS; + bg %= COLORS; for (short pair = 17; pair < colorPairs; ++pair) { short f, b; pair_content(pair, &f, &b); if (f == fg && b == bg) return pair; } - init_pair(colorPairs, fg % COLORS, bg % COLORS); + init_pair(colorPairs, fg, bg); return colorPairs++; } |