Hacker News new | ask | show | jobs
by josephwegner 958 days 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.

2 comments

To 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.
Ah that's also a good idea. I added a todo for myself to take a stab at this at some point.
Good call! Updated, thanks for the tip.