Dark mode by local sunlight (2021)

gaws | 30 points

Please use `prefers-color-scheme` to respect users' environments and default preferences instead. It's also worth noting that, for some people, this is more than just a cosmetic choice.

CharlesW | 5 hours ago

Nice experiment, but my Mac already switches to dark mode at the right time (I’m sure windows and Linux can do the same if you want it that way). So defaulting to system preference would already result in the same behaviour (while also covering users who always prefer light or dark).

growt | 3 hours ago

Most people that I know that prefer dark mode (myself included) prefer it regardless of sunlight or ambient lighting.

jader201 | 6 hours ago

Reminds me of f.lux: https://justgetflux.com/

dSebastien | 7 hours ago

I never use this. Where I live, one will require dark mode well before the calculated sunset.

acephal | an hour ago

DarkModeBuddy uses the Mac's light sensor. It works so well that I wonder why it's not how the OS works.

I don't care if it's sunny outside. Rainy days in Germany can get quite dark long before Night Shift kicks in.

nicbou | 2 hours ago

Nice! We considered this exact approach but never shipped it in the end. The geolocation permission is probably unnecessary friction and probably an overkill imho... Timezone + rough location (country-level from IP) would get 95% accuracy without the prompt. Most users will bounce on that permission dialog.

Solid work though, especially the twilight transitions. Loving it!!!

SurceBeats | 6 hours ago

That's funny, I implemented something similar for my stumpwm config (common lisp window manager). I created a matrix of themes for the WM, emacs, my terminal (kitty), Firefox, and my RGB light panels that change with time of day: day, late afternoon/evening, sunset/twilight, night, post-midnight, and then broken into multiple desktop variations as a way of visually knowing what virtual desktop I'm currently on. Stumpwm coordinates all of the themes for all the apps and synchronizes them with time and desktop and whatnot.

Really helps with circadian rhythm, I've found. Especially because I take a live webcam feed and convolve a hexagonal mask to match my light panel's layout, so it's like having a low res window from whatever webcam I would like. And, at sunset to night, it smoothly fades the light panels into a display that represents a angle compressed sky projection of the stars relative to a fixed location moon with live phase displayed.

Obligatory images:

The day themes: https://youtu.be/danulUB-J-k

Light panels: https://imgbox.com/MQfPNjtI <- sunset on the hex display

https://imgbox.com/qcrFxncU <- random cloudy day hex display

https://imgbox.com/EOFk63WZ <- a night still of the hex display

triclops200 | 3 hours ago

Good idea to make it more humane. It should depend on insolation in the current place (it could differ in close locations), or user preferences. I'd prefer to turn automatic dark mode off at all. It would be great if the transition to dark mode be invisible. Like after locking laptop's screen, not in the process of work.

pavelai | 5 days ago

I use Noir extension on my iphone/ipad, does it automatically when iOS/iPadOS goes into night/dark mode (which is also geo-based). Works great on OLED screens!

alfanick | 6 hours ago

I think it would be more useful to toggle it based on ambient lighting.

vachina | 7 hours ago

Would be nice to fade instead of binary dark/light

thenthenthen | 4 hours ago

Syncing dark mode or f.lux or OS night mode to local sunlight is nice if you live near the equator, but for folks living in the far north, it actually makes seasonal changes so much worse.

Let the user decide the schedule, please.

cluckindan | 5 hours ago

I know this is from 2021, but for the love of god stop with the toggles. I have one toggle, it works system-wide. Respect it. You don't have to guess what theme I want, I already told my OS.

halapro | 4 hours ago