summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--catgirl.116
-rw-r--r--ui.c35
2 files changed, 42 insertions, 9 deletions
diff --git a/catgirl.1 b/catgirl.1
index 5aaee2b..c5ac74e 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd March  8, 2021
+.Dd March 17, 2021
 .Dt CATGIRL 1
 .Os
 .
@@ -685,7 +685,19 @@ Toggle underline.
 .El
 .
 .Pp
-To set colors, follow
+Some color codes can be inserted
+with the following:
+.Bl -column "C-z A" "magenta" "C-z N" "orange (dark yellow)"
+.It Ic C-z A Ta gray Ta Ic C-z N Ta brown (dark red)
+.It Ic C-z B Ta blue Ta Ic C-z O Ta orange (dark yellow)
+.It Ic C-z C Ta cyan Ta Ic C-z P Ta pink (light magenta)
+.It Ic C-z G Ta green Ta Ic C-z R Ta red
+.It Ic C-z K Ta black Ta Ic C-z W Ta white
+.It Ic C-z M Ta magenta Ta Ic C-z Y Ta yellow
+.El
+.
+.Pp
+To set other colors, follow
 .Ic C-z c
 by one or two digits for the foreground color,
 optionally followed by a comma
diff --git a/ui.c b/ui.c
index ebae222..add6eb3 100644
--- a/ui.c
+++ b/ui.c
@@ -1012,13 +1012,34 @@ static void keyCtrl(wchar_t ch) {
 
 static void keyStyle(wchar_t ch) {
 	uint id = windows.ptrs[windows.show]->id;
-	switch (iswcntrl(ch) ? ch ^ L'@' : (wchar_t)towupper(ch)) {
-		break; case L'B': edit(id, EditInsert, B);
-		break; case L'C': edit(id, EditInsert, C);
-		break; case L'I': edit(id, EditInsert, I);
-		break; case L'O': edit(id, EditInsert, O);
-		break; case L'R': edit(id, EditInsert, R);
-		break; case L'U': edit(id, EditInsert, U);
+	if (iswcntrl(ch)) ch = towlower(ch ^ L'@');
+	enum Color color = Default;
+	switch (ch) {
+		break; case L'A': color = Gray;
+		break; case L'B': color = Blue;
+		break; case L'C': color = Cyan;
+		break; case L'G': color = Green;
+		break; case L'K': color = Black;
+		break; case L'M': color = Magenta;
+		break; case L'N': color = Brown;
+		break; case L'O': color = Orange;
+		break; case L'P': color = Pink;
+		break; case L'R': color = Red;
+		break; case L'W': color = White;
+		break; case L'Y': color = Yellow;
+		break; case L'b': edit(id, EditInsert, B);
+		break; case L'c': edit(id, EditInsert, C);
+		break; case L'i': edit(id, EditInsert, I);
+		break; case L'o': edit(id, EditInsert, O);
+		break; case L'r': edit(id, EditInsert, R);
+		break; case L'u': edit(id, EditInsert, U);
+	}
+	if (color != Default) {
+		char buf[4];
+		snprintf(buf, sizeof(buf), "%c%02d", C, color);
+		for (char *ch = buf; *ch; ++ch) {
+			edit(id, EditInsert, *ch);
+		}
 	}
 }
 
1fcae5173cb8b5f092a53e61de22d9ca85&follow=1'>Add scoop output format optionJune McEnroe 2019-12-31Refactor scoop formatters and group colored outputJune McEnroe 2019-12-31Add strftime format string optionJune McEnroe 2019-12-31Refactor binding in scoopJune McEnroe 2019-12-31Add option to group events by contextJune McEnroe 2019-12-31Add missing includeJune McEnroe 2019-12-31Use standout mode for highlightingJune McEnroe 2019-12-31Rewrite scoop(1) argument descriptionsJune McEnroe 2019-12-31Color both nicks in a changeJune McEnroe 2019-12-31Implement nick-colored outputJune McEnroe 2019-12-31Only enable highlighting on terminal outputJune McEnroe 2019-12-31Set up pager pipeJune McEnroe 2019-12-30Normalize date inputJune McEnroe Mostly this just allows the use of 'now'. 2019-12-30Add initial rough version of scoopJune McEnroe 2019-12-30Join with USING wherever possibleJune McEnroe 2019-12-30Add -D flag to prospective scoop manualJune McEnroe 2019-12-30Order results by ID in outer query in litterboxJune McEnroe 2019-12-30Use X macro for Type enumJune McEnroe 2019-12-30Remove scoop -ABCJune McEnroe I can almost get these to work with an inner and outer SQL query, but when contexts starts overlapping it becomes a disaster, so I'm leavin it out at least for now. 2019-12-30Add limit option for litterbox's search query interfaceJune McEnroe