Check out example codes for "css dark mode". It will help you in understanding the concepts better.

Code Example 1

@media (prefers-color-scheme: dark) {

}

Code Example 2

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

@media screen and (prefers-color-scheme: light) {
  body {
    background-color: white;
    color: black;
  }
}

Code Example 3

/* 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");
}
*/

Code Example 4

@media (prefers-color-scheme: dark) {
  body {
    background-color: black;
    color: white;
  }
}

Learn ReactJs, React Native from akashmittal.com