dark mode css

CSS
body {
  background-color: black;
  color: white;
}

@media screen and (prefers-color-scheme: light) {
  body {
    background-color: white;
    color: black;
  }
}/* Answer to: "css dark mode toggle" */

/*
  Switch between dark and light mode with CSS and JavaScript using
  the tutorial you find at W3Schools, here's a link:
  Switch between dark and light mode with CSS and JavaScript.
*/

body {
  padding: 25px;
  background-color: white;
  color: black;
  font-size: 25px;
}

.dark-mode {
  background-color: black;
  color: white;
}

/*
JavaScript:
function myFunction() {
  var element = document.body;
  element.classList.toggle("dark-mode");
}
*/
Source

Also in CSS: