Mainly for web dev.
Resources
- An easy HTML/CSS/JS no-nonsense implementation of dark mode.
- Posts by Sara Joy:
CSS
In CSS, we can declare properties that only apply if the given operating system or web browser prefers a certain colour scheme:
@media (prefers-color-scheme: dark) {
:root {
background-color: #ffffff;
}
}
We don’t need to cover both cases. By default our properties should apply to one colour mode.