From 5793a64d65611746381b1ae39775e1a7c9227f0d Mon Sep 17 00:00:00 2001 From: edo999 Date: Fri, 29 Mar 2024 10:21:08 +0000 Subject: [PATCH] =?UTF-8?q?Improve=20dark=20mode=20=F0=9F=8C=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/styles/global.css | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/styles/global.css b/src/styles/global.css index 0c9e13c..23480cb 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -1,3 +1,29 @@ +/* With color-scheme the UA will style some elements appropriately. */ +:root { + color-scheme: light dark; +} +@media (prefers-color-scheme: dark) { + :root { + color-scheme: dark; + } +} +.light { + color-scheme: light; +} +.dark { + color-scheme: dark; +} +/* Transition color scheme change. */ +body { + transition-duration: 150ms; + transition-property: color, background-color; +} + +/* Slightly dim the images to avoid heavy contrast. */ +.dark img { + filter: brightness(0.8) contrast(1.2); +} + /* Link everywhere (but in prose). */ .themed-link { /* Inlining to avoid mistakes. */