DEV Community


Posted on

Create Dark mode website theme by adding a single line of CSS

Alt Text

We all know that now a days dark website theme become very popular each and every popular sites are providing dark theme.

You know need to write multiple line of Javascript or jQuery or even CSS to achieve this. All you need is just one line of CSS.

Still don't believe me?
Without wasting time let's jump into the code.

Here's the code

html.dark-theme {
    filter: invert(1);
Enter fullscreen mode Exit fullscreen mode

Click here for live example

Top comments (3)

w3abhishek profile image
Abhishek Verma

It's not good to just invert everything.