Closed gka closed 9 months ago
For some of the examples in my SveltePress page I would love to know if the page is currently in dark or light mode.
it would be great if from my Svelte pages and live components I could just access a global isDark store, perhaps like this
isDark
import { getContext } from 'svelte'; const { isDark } = getContext('sveltepress');
The alternative would be to somehow track if there's a .dark class set on the <html> element, which doesn't really work reactively without a lot of hazzle.
.dark
<html>
nice to have
Thanks for your feedback! This feature would be considered to add in the next release.
New docs: https://sveltepress.site/reference/default-theme/#Global-context
Describe the problem
For some of the examples in my SveltePress page I would love to know if the page is currently in dark or light mode.
Describe the proposed solution
it would be great if from my Svelte pages and live components I could just access a global
isDark
store, perhaps like thisAlternatives considered
The alternative would be to somehow track if there's a
.dark
class set on the<html>
element, which doesn't really work reactively without a lot of hazzle.Importance
nice to have