diff options
author | Paul Duncan <pabs@pablotron.org> | 2025-03-31 13:28:11 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2025-03-31 13:28:11 -0400 |
commit | 17afa402c68efb580beb6993f6ae87608e72b1cf (patch) | |
tree | 9a54d883292cb6ff2bfd95fd02346cc457216f1f | |
parent | 9e1b5d07271588e5063709bcf17a48a7905d25e5 (diff) | |
download | pablotron.org-17afa402c68efb580beb6993f6ae87608e72b1cf.tar.xz pablotron.org-17afa402c68efb580beb6993f6ae87608e72b1cf.zip |
content/articles/site-backend.md: update color scheme documentation
-rw-r--r-- | content/articles/site-backend.md | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/content/articles/site-backend.md b/content/articles/site-backend.md index cd15a8d..b235e99 100644 --- a/content/articles/site-backend.md +++ b/content/articles/site-backend.md @@ -101,9 +101,8 @@ mobile-friendly: - links and table components have `title` and `aria-label` attributes - images have captions, fallback formats, and `title` and `alt` attributes - images scale gracefully to thumbnails on mobile -- the site supports [dark mode][], checks the [color scheme - preference][prefers-color-scheme] to determine the default theme, - and has a [manual theme switcher][post-theme-switcher] +- supports light and [dark mode][] and has a [manual theme + switcher][post-theme-switcher] - The menu bar collapes to a hamburger menu on mobile. Here are a few articles which cover guidelines that I follow: @@ -180,11 +179,10 @@ const D = document, M = window.matchMedia, on = (el, id, fn) => el.addEventListener(id, fn); -// use theme if set, otherwise fall back to browser preference -if (L && L.theme && L.theme === 'dark') { - C.add('dark'); // theme set to "dark" -} else if ((!L || !L.theme) && M && M('(prefers-color-scheme: dark)').matches) { - C.add('dark'); // prefers dark color scheme +// use theme if set, otherwise fall back dark mode +C.add('dark'); +if (L && L.theme && L.theme === 'light') { + C.remove('dark'); // set light theme } document.addEventListener('DOMContentLoaded', () => { @@ -593,6 +591,7 @@ published. inline [SVGs][svg] work fine, but viewing them directly just shows a black box. - 2025-01-30: Added [robots.txt][] info to [Other](#other). +- 2025-03-31: Update wording to reflect the following changes: default to dark mode and remove [`prefers-color-scheme`][prefers-color-scheme] detection. [s-hugo-configuration]: #hugo-configuration "Hugo Configuration" |