summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/man1/shotty.19
-rw-r--r--bin/shotty.c20
2 files changed, 22 insertions, 7 deletions
diff --git a/bin/man1/shotty.1 b/bin/man1/shotty.1
index 7500f20b..e6ecf2ca 100644
--- a/bin/man1/shotty.1
+++ b/bin/man1/shotty.1
@@ -1,4 +1,4 @@
-.Dd July 9, 2019
+.Dd July 11, 2019
 .Dt SHOTTY 1
 .Os
 .
@@ -8,6 +8,7 @@
 .
 .Sh SYNOPSIS
 .Nm
+.Op Fl B
 .Op Fl b Ar bg
 .Op Fl f Ar fg
 .Op Fl h Ar rows
@@ -28,16 +29,22 @@ Terminal output can be captured with
 .Pp
 The arguments are as follows:
 .Bl -tag -width "-w cols"
+.It Fl B
+Replace bold with bright colors.
+.
 .It Fl b Ar bg
 Set the default background color.
 The default value is 0 (black).
+.
 .It Fl f Ar fg
 Set the default foreground color.
 The default value is 7 (white).
+.
 .It Fl h Ar rows
 Set the terminal height.
 If unset,
 the height of the current terminal is used.
+.
 .It Fl w Ar cols
 Set the terminal width.
 If unset,
diff --git a/bin/shotty.c b/bin/shotty.c
index d4a7b160..a70f40b8 100644
--- a/bin/shotty.c
+++ b/bin/shotty.c
@@ -255,11 +255,13 @@ html(const struct Style *prev, const struct Cell *cell) {
 int main(int argc, char *argv[]) {
 	setlocale(LC_CTYPE, "");
 
+	bool bright = false;
 	FILE *file = stdin;
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "b:f:h:w:"))) {
+	while (0 < (opt = getopt(argc, argv, "Bb:f:h:w:"))) {
 		switch (opt) {
+			break; case 'B': bright = true;
 			break; case 'b': def.bg = strtoul(optarg, NULL, 0);
 			break; case 'f': def.fg = strtoul(optarg, NULL, 0);
 			break; case 'h': rows = strtoul(optarg, NULL, 0);
@@ -285,11 +287,9 @@ int main(int argc, char *argv[]) {
 	if (!cells) err(EX_OSERR, "calloc");
 
 	style = def;
-	for (uint y = 0; y < rows; ++y) {
-		for (uint x = 0; x < cols; ++x) {
-			cell(y, x)->style = style;
-			cell(y, x)->ch = ' ';
-		}
+	for (uint i = 0; i < rows * cols; ++i) {
+		cells[i].style = style;
+		cells[i].ch = ' ';
 	}
 
 	wint_t ch;
@@ -298,6 +298,14 @@ int main(int argc, char *argv[]) {
 	}
 	if (ferror(file)) err(EX_IOERR, "getwc");
 
+	if (bright) {
+		for (uint i = 0; i < rows * cols; ++i) {
+			if (!cells[i].style.bold || cells[i].style.fg > 7) continue;
+			cells[i].style.bold = false;
+			cells[i].style.fg += 8;
+		}
+	}
+
 	printf(
 		"<pre style=\"width: %uch;\" class=\"bg%u fg%u\">",
 		cols, def.bg, def.fg