Light πŸŒ‡ / Dark πŸŒƒ mode order on web

iamdtms
Sep 22, 2024

--

DALLE 3 illustration

Theme switch template on Gist

The big question

The mediaSwitch fn. is okay, the btn click fn. also okay, but DOMContentLoad is a bit tricky: If we do not have cookie set, the behaviour is also trivial.

But if cookie set, and another value it has as the current time needed, what is the best value to return?

  var useMode = Cookies.get('mode');

if (useMode == 'light') {
useDark = false;
} if (useMode == 'dark') {
useDark = true;
}
styleSetup();

Is it more important to serve personal view (from cookie) or is it more important to serve time related view?

--

--