summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-13 23:09:21 -0500
committerJune McEnroe <june@causal.agency>2020-12-13 23:09:21 -0500
commitb1079dbd40f7f28b7459f2f9c27bc1a975c9b8c2 (patch)
tree09bb8e7dc3d8f132618443369827a21cfd76cfb0
parentEmulate catgirl in 16-color mode (diff)
downloadlitterbox-b1079dbd40f7f28b7459f2f9c27bc1a975c9b8c2.tar.gz
litterbox-b1079dbd40f7f28b7459f2f9c27bc1a975c9b8c2.zip
Color contexts like catgirl
Well, except for query contexts where the username is lost.
-rw-r--r--scoop.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/scoop.c b/scoop.c
index f5b0692..8c113d5 100644
--- a/scoop.c
+++ b/scoop.c
@@ -145,11 +145,18 @@ static void formatColor(bool group, struct Event e) {
 	static char network[256];
 	static char context[256];
 	if (group && (strcmp(e.network, network) || strcmp(e.context, context))) {
-		printf("%s%s/%s:\n", (network[0] ? "\n" : ""), e.network, e.context);
+		printf(
+			"%s\33[%dm%s/%s\33[m:\n",
+			(network[0] ? "\n" : ""),
+			code(color(e.context)), e.network, e.context
+		);
 		snprintf(network, sizeof(network), "%s", e.network);
 		snprintf(context, sizeof(context), "%s", e.context);
 	} else if (!group) {
-		printf("%s/%s: ", e.network, e.context);
+		printf(
+			"\33[%dm%s/%s\33[m: ",
+			code(color(e.context)), e.network, e.context
+		);
 	}
 
 	printf("[%s] ", e.time);