Simple light/dark mode
marcamos.com·28w

Demo

The code below is what I use on this website – scroll/swipe down to the footer and play with the options within Color scheme to see it in action.

Code

What follows will allow a visitor to choose between light mode, dark mode, or the mode their device is currently in (which I’ve labeled System). This System option is useful if the visitor’s device is configured to automatically switch between light and dark modes based on the time of day.

HTML

Fairly straightfoward HTML; mark it up however you see fit, just make sure the <input> elements keep these attributes.

<label>
<input type="radio" name="color-scheme" value="light dark">
System
</label>
<label>
<input type="radio" name="color-scheme" value="light">
Light
</label>
<label>
<input type="radio" name...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help