From 60d50a90f2e4d1d3f909808dd32cc5b5541a4ef4 Mon Sep 17 00:00:00 2001 From: AlexYzhov Date: Fri, 20 Aug 2021 01:52:16 +0800 Subject: add darkmode support css theme will now change at OS level automatically --- layouts/partials/head.html | 3 ++- static/css/darkmode.css | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 static/css/darkmode.css diff --git a/layouts/partials/head.html b/layouts/partials/head.html index d562495..166571a 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -14,5 +14,6 @@ + -{{ hugo.Generator -}} \ No newline at end of file +{{ hugo.Generator -}} diff --git a/static/css/darkmode.css b/static/css/darkmode.css new file mode 100644 index 0000000..fee713a --- /dev/null +++ b/static/css/darkmode.css @@ -0,0 +1,35 @@ +@media (prefers-color-scheme: dark) { + html, body { + color: #dcdcdc; + background-color: #292929; + } + + html *:not(input) { + color: #dcdcdc !important; + } + + a[ping]:link, + :link:not(cite) { + color: #8db2e5 !important; + } + + html a:visited { + color: #d248ea !important; + } + + html cite, + html cite a:link, + html cite a:visited { + color: #92de92 !important; + } + + /* inline styles */ + [style*='background: #'], [style*='background:#'], + [style*='background: rgb'], [style*='background:rgb'], + [style*='background: var('], [style*='background:var('], + [style*='background-color: #'], [style*='background-color:#'], + [style*='background-color: rgb'], [style*='background-color:rgb'], + [style*='background-color: var('], [style*='background-color:var('] { + background-color: #292929 !important; + } +} -- cgit v1.2.3