CSS only dark mode without JS – Simon Dalvai

This css one liner can define how your site looks on a device with dark mode set in the browser settings.

@media (prefers-color-scheme: dark)

Or if your main style is dark mode, you can define how the light mode will look.

@media (prefers-color-scheme: light)
Source: CSS only dark mode without JS – Simon Dalvai

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.