w3.css dark mode code example
Example 1: dark mode css
body {
background-color: black;
color: white;
}
@media screen and (prefers-color-scheme: light) {
body {
background-color: white;
color: black;
}
}
Example 2: css dark mode
@media (prefers-color-scheme: dark) {
body {
background-color: black;
color: white;
}
}