3 tips for using Darkmode.js in your application
This post assumes you are using Darkmode.js as an npm package. It is also only a list of quick tips I wish I had when first getting started with the library and not a full tutorial.
1) How to override a default Darkmode style
I needed this specifically for elements that exist outside of the normal DOM because Darkmode.js does not apply styles to them. These are elements positioned absolute or fixed, which for my example was the footer. To apply styles to the footer for darkmode you have to specify the css within the `.darkmode--activated` class..darkmode--activated footer {
div {
color: white;
}
}
2) How to ignore an element when Darkmode is activated
Add a class of `darkmode-ignore` to the element you'd like to avoid being affected by the package. For DevDecks that was the color palette on the settings page. I wanted those colors to be constant and not affected by the package. ```html" id="020887" style="--color: #020887">
Blue
```