From 2c6ca005d47a2fed8afb6840f4ddaa9808c0a5e4 Mon Sep 17 00:00:00 2001 From: supercolbat Date: Sat, 5 Aug 2023 10:31:24 -0500 Subject: [PATCH] Fix theme switcher under certain conditions When privacy.resistFingerprinting set to true on Firefox, the `prefers-color-scheme` can never work. --- src/app.css | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/app.css b/src/app.css index c1fa756..6ec76af 100644 --- a/src/app.css +++ b/src/app.css @@ -17,9 +17,22 @@ html.light { --alt: #ddd; --alt-text: #333; --black: #151515; + --body-text: #666; color-scheme: light; } +html.dark { + --primary: #151515; + --secondary: #1d1d1d; + --tertiary: #353535; + --text: #ffffffde; + --grey: #5454547a; + --alt: #333; + --alt-text: #ddd; + --body-text: #bbb; + color-scheme: dark; +} + @media (prefers-color-scheme: dark) { html { --primary: #151515; @@ -29,6 +42,7 @@ html.light { --grey: #5454547a; --alt: #333; --alt-text: #ddd; + --body-text: #bbb; color-scheme: dark; } } @@ -50,23 +64,32 @@ a:hover { } h1 { - @apply text-4xl font-bold my-8 border-b-2 border-accent pb-2; + @apply text-4xl font-bold mt-8 mb-2 border-b-2 border-accent pb-2; } .h1-no-lg { - @apply my-8 border-b-2 border-accent pb-2; + @apply mt-8 mb-2 border-b-2 border-accent pb-2; } h2 { - @apply text-3xl font-bold my-8; + @apply text-3xl font-bold mt-8 mb-2; } h3 { - @apply text-2xl font-bold my-8; + @apply text-2xl font-bold mt-8 mb-2; } h4 { - @apply text-xl font-bold my-8; + @apply text-xl font-bold mt-8 mb-2; +} + +p { + color: var(--body-text); +} + +/* Between-paragraph spacing */ +p + p { + @apply mt-4; } summary {