From 6e679bdf26fa4dae651aade985155bd424761a3a Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Wed, 5 Feb 2020 04:24:13 -0500 Subject: Modulo colors before comparing pairs Otherwise a new pair is allocated every time a high color is requested. --- ui.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui.c') 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++; } -- cgit 1.4.1-2-gfad0