4 ms·
Really great article, and the site looks great! One small piece of feedback: > the server-rendered HTML will always default to light mode. This creates a flick
by josephwegner 3y ago
Really great article, and the site looks great! One small piece of feedback:
> the server-rendered HTML will always default to light mode. This creates a flicker for night owls
You might consider switching this - render the dark-mode version by default, and have the flicker be from dark-to-light. For users operating mostly in dark mode, a bright flash of white can be painful. The same is not true for users operating in light mode - they will barely notice a moment of dark.
- theodorejb 3y agoTo avoid a flicker, add <meta name="color-scheme" content="light dark" /> to the <head> tag, and also put the JavaScript code in <head> so it runs before any content is shown.
- petemilly 3y agoAh that's also a good idea. I added a todo for myself to take a stab at this at some point.
- petemilly 3y agoGood call! Updated, thanks for the tip.