☀️

iamdtms | blog

Light Dark Mode UX variants

Two options

There are two (or more) options having light/dark mode on apps.

Store user setting

  1. If light/dark mode change happens, then store it
  • in cookie/local-store
  • and when the same user returns give the settings back
  1. Problems with this
  • frontend side storage is not a big deal
  • time related settings are not validate

Media variant

  1. device/desktop light/dark mode been followed
  • the app can get the exact mode this way
  • changing the mode also validates on the app side as well
  • JS code snippet here:

window.matchMedia(‘(prefers-color-scheme: dark)’).addEventListener(‘change’, () => {
setDarkMode(true);
});

Conclusion

Actually, I prefer the second option; client-side storage isn’t really a big deal, and with this, we losing the ability to serve the actual mode. It’s a problem IMHO.

, , , , , — May 27, 2026