From af0a758eb9f72564fa92a845f2974954bce55b02 Mon Sep 17 00:00:00 2001 From: Alvie Rahman Date: Tue, 12 Apr 2022 17:22:02 +0100 Subject: [PATCH] simplify dark mode implementation --- base.css | 16 ++++++++-------- modules/darkmode.css | 18 ++++-------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/base.css b/base.css index a31020c..b6ee69a 100644 --- a/base.css +++ b/base.css @@ -1,24 +1,24 @@ :root { - --fg-light-mode: #454545; - --bg-light-mode: #fefefe; - --a-light-mode: #07a; - --a-visited-light-mode: #941352; + --fg: #454545; + --bg: #fefefe; + --a: #07a; + --a-visited: #941352; } body { font-family: monospace, sans-serif; - color: var(--fg-light-mode); + color: var(--fg); font-size: 16px; margin: 2em auto; max-width: 800px; padding: 1em; line-height: 1.4; overflow-wrap: break-word; - background-color: var(--bg-light-mode); + background-color: var(--bg); } -a { color: var(--a-light-mode); } -a:visited { color: var(--a-visited-light-mode); } +a { color: var(--a); } +a:visited { color: var(--a-visited); } .tableWrapper { max-width: 100%; diff --git a/modules/darkmode.css b/modules/darkmode.css index 8ebf136..a26d891 100644 --- a/modules/darkmode.css +++ b/modules/darkmode.css @@ -1,15 +1,11 @@ :root { - --fg-dark-mode: #ccc; - --bg-dark-mode: #111; - --a-dark-mode: #07a; - --a-visited-dark-mode: #aa346d; + --fg: #ccc; + --bg: #111; + --a: #07a; + --a-visited: #aa346d; } @media (prefers-color-scheme: dark) { - body { - color: var(--fg-dark-mode); - background-color: var(--bg-dark-mode); - } img, video { opacity: .75; transition: opacity .5s ease-in-out; @@ -17,10 +13,4 @@ img:hover, video:hover { opacity: 1; } - a { - color: var(--a-dark-mode); - } - a:visited { - color: var(--a-visited-dark-mode); - } }