

One line of CSS to add basic dark/light mode
source link: https://christianheilmann.com/2022/06/20/one-line-of-css-to-add-basic-dark-light-mode/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

One line of CSS to add basic dark/light mode
Monday, June 20th, 2022 at 11:33 pm
When 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
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK