Closed gdmka closed 2 years ago
@panr Have you got a chance to look at these changes? They would make for a good default behaviour for this theme.
Hey, I still haven't ;-( I'll check it as soon as I can 🙏
This also probably eliminates the need for:
<body class="{{ if ne $.Site.Params.defaultTheme "light" -}} dark-theme {{- end -}}">
In the base layout.
@panr any resolution? this PR is pretty trivial and is proven to work by some commenters
Here's what you wanted: https://github.com/panr/hugo-theme-hello-friend/commit/e99e832d946e4741bdb30f0b9ee5b5b84e0b2423
When it comes to OS Theme I rely on CSS media-queries and use matchMedia()
only for toggling themes.
Hi @panr, i have noticed that OS-based preferred color scheme is not supported yet. So i implemented a trivial solution that does exactly this.
It follows current flow:
prefers-color-scheme
feature and set the theme accordingly.Tested with FF 91, Chrome 92.0.45, Safari 14.1.2 and iOS 14.7.1 Safari. Works as expected.