Adding Dark Mode to Your React App with Emotion CSS-in-JS

added by JavaScript Kicks
1/7/2020 11:37:43 AM

455 Views

At the moment, it does not do anything besides toggling the internal state of isDark value and change text. In dark mode, we will want to change: Text color to #fff Background-color to #121212 Invert button text, button background-color, and hover colors We are using emotion for styling because it is simple, but the concept will work if you are using pure CSS or CSSModule (you will need to set the theme in context and toggle class name in the component).


0 comments