From 4b891922e10ce3de0e562a21c1aeeb9341a17c8c Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 23 Aug 2020 18:35:34 -0400 Subject: Use CSS variables in scheme output --- bin/scheme.c | 12 ++++++++---- 1 file 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 ); } } -- cgit 1.4.1