summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-23 18:35:34 -0400
committerJune McEnroe <june@causal.agency>2020-08-23 18:35:34 -0400
commit4b891922e10ce3de0e562a21c1aeeb9341a17c8c (patch)
treed805a40ce2adc24836357d398c510bf049254333 /bin
parentAdd catsit to causal.agency (diff)
downloadsrc-4b891922e10ce3de0e562a21c1aeeb9341a17c8c.tar.gz
src-4b891922e10ce3de0e562a21c1aeeb9341a17c8c.zip
Use CSS variables in scheme output
Diffstat (limited to '')
-rw-r--r--bin/scheme.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/scheme.c b/bin/scheme.c
index 920ebc74..9acb2e31 100644
--- a/bin/scheme.c
+++ b/bin/scheme.c
@@ -175,13 +175,17 @@ static void outputMintty(const struct HSV *hsv, uint len) {
 }
 
 static void outputCSS(const struct HSV *hsv, uint len) {
+	printf(":root {\n");
 	for (uint i = 0; i < len; ++i) {
 		struct RGB rgb = convert(hsv[i]);
+		printf("\t--ansi%u: #" FORMAT_RGB ";\n", i, rgb.r, rgb.g, rgb.b);
+	}
+	printf("}\n");
+	for (uint i = 0; i < len; ++i) {
 		printf(
-			".fg%u { color: #" FORMAT_RGB "; }\n"
-			".bg%u { background-color: #" FORMAT_RGB "; }\n",
-			i, rgb.r, rgb.g, rgb.b,
-			i, rgb.r, rgb.g, rgb.b
+			".fg%u { color: var(--ansi%u); }\n"
+			".bg%u { background-color: var(--ansi%u); }\n",
+			i, i, i, i
 		);
 	}
 }