Check out example codes for "user preferred color scheme". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com