summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-10 05:33:31 -0500
committerJune McEnroe <june@causal.agency>2020-02-10 05:33:31 -0500
commitb9a6d35b659e5eba69897d27cee0091821fbe897 (patch)
tree2a85b8d7abc63679c703f50a9654ad3e938e1386
parentSupport all 99 IRC colors (diff)
downloadcatgirl-b9a6d35b659e5eba69897d27cee0091821fbe897.tar.gz
catgirl-b9a6d35b659e5eba69897d27cee0091821fbe897.zip
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.
Diffstat (limited to '')
-rw-r--r--ui.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui.c b/ui.c
index e36585a..3f730d2 100644
--- a/ui.c
+++ b/ui.c
@@ -133,13 +133,15 @@ static void colorInit(void) {
 }
 
 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) {
-	if (bg == -1 && fg < 16) return 1 + fg;
 	fg %= COLORS;
 	bg %= COLORS;
+	if (bg == -1 && fg < 16) return 1 + fg;
 	for (short pair = 17; pair < colorPairs; ++pair) {
 		short f, b;
 		pair_content(pair, &f, &b);
f='/src/commit/txt/books.txt?id=f493e81375faa63be0bc6e89ddcdbd805be075c0&follow=1'>Add A Closed and Common OrbitJune McEnroe 2019-06-02Add RebornJune McEnroe 2019-05-30Add bit to bin.7June McEnroe 2019-05-30Simplify and build bitJune McEnroe lex is a waste of time. 2019-05-29Add xx -p optionJune McEnroe 2019-05-27Add FrontierJune McEnroe 2019-05-27Break nicks with ZWNJJune McEnroe This should prevent bad wrapping. 2019-05-26Add DawnJune McEnroe 2019-05-20Declare vasprintf(3) for GNUJune McEnroe who the fuck is scraeming "#define _GNU_SOURCE" at my house. show yourself, coward. i will never #define _GNU_SOURCE 2019-05-20Fix comparison warning in ttpreJune McEnroe 2019-05-20Add AuthorityJune McEnroe 2019-05-19Specify precedence of unary versions of operatorsJune McEnroe 2019-05-18Add compound assignment operators to orderJune McEnroe 2019-05-15Support simple assignment in orderJune McEnroe 2019-05-15Implement sizeof in orderJune McEnroe 2019-05-15Add orderJune McEnroe 2019-05-12Add T suffix in bitJune McEnroe 2019-05-10Highlight yacc and lex files as CJune McEnroe Their %-prefixed directives should probably be highlighted Macro. 2019-05-10Use val instead of suboptargJune McEnroe suboptarg doesn't exist in GNU. Hopefully BSD getsubopt also sets val on failure? 2019-05-09Add Parable of the SowerJune McEnroe 2019-05-07Add bit without buildJune McEnroe Need to do some stuff in the Makefile for lex and yacc and generating HTML pages for it. 2019-05-04Fix MANDIR typoJune McEnroe 2019-05-04Move relay to binJune McEnroe