Skip to main content

Default Dark Mode?

Does anyone know how, with the use of a snippet, to make the default/initial setup dark mode?

Mat β€Ž

Paul HopkinsΒ I hope we will be able to set a Default or a System or a Theme Colors Mode in the nearest future. If you use Dark Mode only then as a workaround just switch your color on the light pallete to the Dark colors and Disable the option to switch to real Dark mode.

Adding related link

Paul Hopkins

Mat β€ŽΒ thanks for the hack idea :-)

I have found a solution :)

Use this code snippet:

add_action('fluent_community/portal_head', function() {
?>

document.documentElement.classList.add('dark'); document.documentElement.setAttribute('data-mode', 'dark'); [data-mode=dark] { color-scheme: dark; }

<?php
});

Paul Hopkins

TjaΕ‘a PeterleΒ sadly, for me, that snippet just prints out document.documentElement.classList.add('dark'); document.documentElement.setAttribute('data-mode', 'dark'); [data-mode=dark] { color-scheme: dark; } at the top of the page.

Paul HopkinsΒ that's weird, it works fine for me... I saw in other thread that you solved this with adding "script" tags correct? πŸ˜„ I will just copy paste final code here in case someone will be searching for it:

add_action('fluent_community/portal_head', function() {
?>
    <script>
document.documentElement.classList.add('dark'); document.documentElement.setAttribute('data-mode', 'dark'); [data-mode=dark] { color-scheme: dark; }
    </script>
<?php
});

Paul Hopkins

TjaΕ‘a PeterleΒ it looks like your original post stripped the β€˜script’ line. FC needs you to use β€˜/code’ to keep that in the post. Thanks again!