Skip to content

How do I enable the light mode by default? #196

Closed Answered by lamurian
lamurian asked this question in Q&A
Discussion options

You must be logged in to vote

After digging around, I managed to set the light mode as its default theme by changing assets/js/darkmode.js into:

var themeToggleDarkIcon = document.getElementById('theme-toggle-dark-icon');
var themeToggleLightIcon = document.getElementById('theme-toggle-light-icon');

// Change the icons inside the button based on previous settings
if (localStorage.getItem('color-theme') === 'dark') {
    themeToggleLightIcon.classList.remove('hidden');
    document.documentElement.classList.add('dark');
} else {
    themeToggleDarkIcon.classList.remove('hidden');
    document.documentElement.classList.remove('dark');
    localStorage.setItem('color-theme', 'light');  // Ensure light mode is set by def…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lamurian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant