One line of CSS to add basic dark/light mode
Monday, June 20th, 2022 at 11:33 pmWhen you have your OS set up in dark mode seeing bright form elements is grating. By starting your style sheet with a single line of CSS, you can make sure that people using dark mode get dark form elements and backgrounds and those using light mode, light ones.
You can see it in this codepen
See the Pen
color-scheme by Christian Heilmann (@codepo8)
on CodePen.
You can also use the browser developer tools to simulate the different modes to see the difference.
Read more about color-scheme on the MDN web docs.