The following three lines are all that is required to enable responsive default dark mode support.[fn:1]
body {
color-scheme: light dark; /* tells the browse that the page supports both light and dark modes */
color: CanvasText; /* sets the default text color to the browser's responsive default */
background-color: Canvas; /* sets the default background color to the browser's responsive default */
}[fn:1] https://dev.to/madsstoumann/dark-mode-in-3-lines-of-css-and-other-adventures-1ljj