diff options
author | June McEnroe <june@causal.agency> | 2020-08-23 18:35:34 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-08-23 18:35:34 -0400 |
commit | 4b891922e10ce3de0e562a21c1aeeb9341a17c8c (patch) | |
tree | d805a40ce2adc24836357d398c510bf049254333 | |
parent | Add catsit to causal.agency (diff) | |
download | src-4b891922e10ce3de0e562a21c1aeeb9341a17c8c.tar.gz src-4b891922e10ce3de0e562a21c1aeeb9341a17c8c.zip |
Use CSS variables in scheme output
Diffstat (limited to '')
-rw-r--r-- | bin/scheme.c | 12 |
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 ); } } |