aboutsummaryrefslogtreecommitdiff
path: root/src/gistatic.c
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-08-20 12:32:57 -0300
committerEuAndreh <eu@euandre.org>2021-08-20 12:42:28 -0300
commit580259c41b653d72e96f6bb941565a0df5c9ac1f (patch)
tree5bcf6c4efea91ac7267adc3cf64f0e3cf559fd7d /src/gistatic.c
parentMakefile: Generate build samples before running the tests (diff)
downloadgistatic-580259c41b653d72e96f6bb941565a0df5c9ac1f.tar.gz
gistatic-580259c41b653d72e96f6bb941565a0df5c9ac1f.tar.xz
src/gistatic.c: Add dark mode CSS media query
Diffstat (limited to 'src/gistatic.c')
-rw-r--r--src/gistatic.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/gistatic.c b/src/gistatic.c
index bb89bed..2630992 100644
--- a/src/gistatic.c
+++ b/src/gistatic.c
@@ -209,6 +209,40 @@ static const char *const LOGO_STR = ""
"</svg>\n";
static const char *const STYLE_STR = ""
+ ":root {\n"
+ " --color: black;\n"
+ " --background-color: white;\n"
+ " --hover-color: hsl(0, 0%, 93%);\n"
+ " --nav-color: hsl(0, 0%, 87%);\n"
+ "}\n"
+ "\n"
+ "@media(prefers-color-scheme: dark) {\n"
+ " :root {\n"
+ " --color: white;\n"
+ " --background-color: black;\n"
+ " --hover-color: hsl(0, 0%, 7%);\n"
+ " --nav-color: hsl(0, 0%, 13%);\n"
+ " }\n"
+ "\n"
+ " body {\n"
+ " color: var(--color);\n"
+ " background-color: var(--background-color);\n"
+ " }\n"
+ "\n"
+ " a {\n"
+ " color: hsl(211, 100%, 60%);\n"
+ " }\n"
+ "\n"
+ " a:visited {\n"
+ " color: hsl(242, 100%, 80%);\n"
+ " }\n"
+ "\n"
+ " .logo {\n"
+ " color: white;\n"
+ "\n"
+ " }\n"
+ "}\n"
+ "\n"
"body {\n"
" font-family: monospace;\n"
" max-width: 1100px;\n"
@@ -245,19 +279,19 @@ static const char *const STYLE_STR = ""
" margin-left: 10px;\n"
"}\n"
"\n"
- "nav a {\n"
+ "nav a, nav a:visited {\n"
" padding: 2px 8px 0px 8px;\n"
- " color: black;\n"
+ " color: var(--color);\n"
"}\n"
"\n"
".selected-nav-item {\n"
- " background-color: hsl(0, 0%, 87%);\n"
+ " background-color: var(--nav-color);\n"
"}\n"
"\n"
"hr {\n"
" margin-top: 0;\n"
" border: 0;\n"
- " border-top: 3px solid hsl(0, 0%, 87%);\n"
+ " border-top: 3px solid var(--nav-color);\n"
"}\n"
"\n"
"table {\n"
@@ -269,7 +303,7 @@ static const char *const STYLE_STR = ""
"}\n"
"\n"
"tbody tr:hover {\n"
- " background-color: hsl(0, 0%, 93%);\n"
+ " background-color: var(--hover-color);\n"
"}\n"
"\n"
"td {\n"