Vanilla-OS / chronos-frontend

A frontend in Vue.js for the Chronos documentation server.
https://docs.vanillaos.org
GNU Affero General Public License v3.0
6 stars 4 forks source link

Feature request: add auto-switcher for dark/light mode to use system setting #60

Closed kbdharun closed 1 month ago

GabsEdits commented 1 month ago

It seems that this was already implemented in https://github.com/Vanilla-OS/chronos-frontend/commit/0dccff68ffdcdd9cc190cb4d16b171842f3b8fa3#diff-7a7a37b12ee1265d7e27577ec286120d2cbc0940908635e264a2be44ccb9a8a0R124-R131 :

    const userPrefersDark = localStorage.getItem('darkMode') === 'true' ||
      (!('darkMode' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches);
    if (userPrefersDark) {
      document.documentElement.classList.add('dark');
      this.isDarkMode = true;
    }

The issue is that there is something wrong somewhere in the code. I will investigate it