summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/man/scheme.15
-rw-r--r--bin/scheme.c15
2 files changed, 18 insertions, 2 deletions
diff --git a/bin/man/scheme.1 b/bin/man/scheme.1
index ae11320d..b2ffc407 100644
--- a/bin/man/scheme.1
+++ b/bin/man/scheme.1
@@ -8,7 +8,7 @@
 .
 .Sh SYNOPSIS
 .Nm
-.Op Fl acghlmtx
+.Op Fl acghilmtx
 .
 .Sh DESCRIPTION
 .Nm
@@ -30,6 +30,9 @@ Output a swatch PNG.
 .It Fl h
 Output HSV.
 .
+.It Fl i
+Swap white and black.
+.
 .It Fl l
 Output Linux console OSC sequences.
 .
diff --git a/bin/scheme.c b/bin/scheme.c
index 8ce5c507..e7dbc0d4 100644
--- a/bin/scheme.c
+++ b/bin/scheme.c
@@ -89,6 +89,18 @@ static void generate(void) {
 	scheme.cursor     = x(scheme.dark[White],    0.0, 1.0, 0.8);
 }
 
+static void swap(struct Hsv *a, struct Hsv *b) {
+	struct Hsv t;
+	t = *a;
+	*a = *b;
+	*b = t;
+}
+
+static void invert(void) {
+	swap(&scheme.dark[Black], &scheme.light[White]);
+	swap(&scheme.light[Black], &scheme.dark[White]);
+}
+
 static void printHsv(struct Hsv hsv) {
 	printf("%g,%g,%g\n", hsv.h, hsv.s, hsv.v);
 }
@@ -265,9 +277,10 @@ int main(int argc, char *argv[]) {
 	bool ansi = true;
 	char out = 'x';
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "acghlmtx"))) {
+	while (0 < (opt = getopt(argc, argv, "acghilmtx"))) {
 		switch (opt) {
 			break; case 'a': ansi = true;
+			break; case 'i': invert();
 			break; case 't': ansi = false;
 			break; case '?': return EX_USAGE;
 			break; default: out = opt;
llow=1'>Set Accept-Encoding in titleJune McEnroe 2019-09-08Set title User-AgentJune McEnroe 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe