Dark Mode Defualt
Has anyone figured out how to do this?
I requested a feature for default darkmode and to stop flashbangs when loading the page for the first time in a session...
You could manually swap the light/dark mode css around in the Settings > Customize Colors, but obviously the light/dark icons would be reversed, although you could probably use some custom css to swap the icons.
Ceez VisionΒ Try this (add it to your themes functions.php or use FlunetSnippets.
This will set the dark mode as the default for first-time visitors only! If they have already visited and switched to dark mode and then back to light mode, it won't override their preference as the choice is saved in their browsers local storage.
phpadd_action('fluent_community/portal_head', function () {
?>
<script>
(function() {
var stored = localStorage.getItem('fcom_global_storage');
if (!stored) {
localStorage.setItem('fcom_global_storage', JSON.stringify({"fcom_color_mode": "dark"}));
}
})();
</script>
<?php
});
If you want to force dark mode for everyone regardless of their saved preference, then this should work. You can then disable Dark Mode in Setting > Customisation to remove the icons.
phpadd_action('fluent_community/portal_head', function () {
?>
<script>
(function() {
var stored = JSON.parse(localStorage.getItem('fcom_global_storage') || '{}');
stored.fcom_color_mode = 'dark';
localStorage.setItem('fcom_global_storage', JSON.stringify(stored));
})();
</script>
<?php
});