Live data from Hacker News

Edison Bulb Night Mode

petemillspaugh.com

21–30 of 34 posts

Re: Edison Bulb Night Mode

#21
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.

Re: Edison Bulb Night Mode

#22

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…

To avoid a flicker, add

    
to the tag, and also put the JavaScript code in so it runs before any content is shown.

Re: Edison Bulb Night Mode

#25
I love the landscape at the bottom of the page! It really gives a sense of the page being a place. I might have to steal that page bottom concept! I've never actually seen it before.

The bulb is a really nice detail, and the color schemes are both really nice.

Re: Edison Bulb Night Mode

#26

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…

Good call! Updated, thanks for the tip.

Re: Edison Bulb Night Mode

#27

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…

To avoid a flicker, add to the tag, and also put the JavaScript code in 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.

Re: Edison Bulb Night Mode

#28
post #12

I like this a lot. I had a similar idea for my own site[0], but I leaned a bit more heavily into the actual cord behavior of the thing. [0] https://svarden.se/post/the-worlds-most-satisfying-toggle

Your lamp is awesome. The little bounce of the cord is really fun

Re: Edison Bulb Night Mode

#29

Two improvements that could be made: 1. My dark mode preferences change throughout the day. Caching the value in localStorage means that it will require manual updates twice a day. Add a behavior that automatically unsets the localStorage key whenever it would set it to the currently system-preferred value. 2. Apply the override using a CSS class on the body element calculated from a synchronous JavaScript block to a…

Thanks, and yeah I was on the fence about #1 (I also like to auto-toggle at night sometimes). My hesitation is that some people might just like one theme better on my website and don't want it to keep resetting based on OS preference. Not sure which case is more common...

#2 is a great idea. I made a todo for myself to do that at some point.

Re: Edison Bulb Night Mode

#30

Very cool! Love the little cord pull. > ...the server-rendered HTML will always default to light mode. This creates a flicker for night owls... I played with this a bit and yes, that flicker is harsh. I appreciate the fade-in, but maybe have the initial color on load be somewhere between light and dark and then fade it to whichever is set by the client.

Thanks! @josephwegner suggested above defaulting to dark, which I did for now.
Post reply on HN