Dark mode setting saved?
Shahjahan Jewel Is the dark mode setting saved to a cookie instead of in the user's profile in WordPress? From my testing, that seems to be the case. If accurate, is there a way to save it to the user's profile so the desired setting will work across devices without having to enable it for each device? Thanks!
You could try setting the dark mode based on user operating system. Or perhaps just force dark mode on page load.
- Customize Your Portal
- Custom Snippets
- Paste custom snippet below and clear cache (private tab)
<script>
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.classList.add('dark');
document.documentElement.setAttribute('data-mode', 'dark');
} else {
document.documentElement.classList.remove('dark');
document.documentElement.setAttribute('data-mode', 'light');
}
</script>
<style>
[data-mode=dark] {
color-scheme: dark;
}
[data-mode=light] {
color-scheme: light;
}
</style>
Tyler Gebhard Thanks. However, I'd prefer to have FC save the setting per user and apply it after login instead of forcing it.
Currently, we are saving the dark mode preference in localStorage. We don't use cookies.
Shahjahan Jewel Are there any plans to have the setting saved in the database so it would activate regardless of where the user logs in? Thanks!