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 | 9a81afc5a0eb7bd78fbd3043d8d7b38eb014e47f (patch) | |
tree | 73fcea03172f3cbdd8746a917ef1727a9dee1f7d | |
parent | Add catsit to causal.agency (diff) | |
download | src-9a81afc5a0eb7bd78fbd3043d8d7b38eb014e47f.tar.gz src-9a81afc5a0eb7bd78fbd3043d8d7b38eb014e47f.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 396512c4..ec5a2eec 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 ); } } |