You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 27, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+30-15
Original file line number
Diff line number
Diff line change
@@ -14,31 +14,46 @@ plugins: [
14
14
]
15
15
```
16
16
17
-
If you'd like to switch between light and dark modes depending on the time of day, `dark-mode.js` is provided, which is a simple script that adds the `.mode-dark` class to the `<html>` element from 6 PM to 6 AM in the user's timezone.
18
-
19
17
## Usage
20
18
21
-
Dark mode must be enabled in your Tailwind configuration for any utilities that need it.
19
+
Styles generated by this plugin are only used if the `mode-dark` class is applied to the `<html>` element. How you do that is up to you. `dark-mode.js` is provided as an option, which is a simple script that enables dark mode from 6 PM to 6 AM in the user's timezone.
The markup above would show a white background with black text by default. If `.mode-dark` was applied to the `<html>` element, the background would be black with white text.
46
+
### Enabling Variants
47
+
48
+
As with existing variants such as `hover` and `focus`, variants for dark mode must be enabled in your Tailwind configuration for any utilities that need them.
Otherwise, PurgeCSS will assume that any classes related to dark mode should be removed, as the `.mode-dark` class is only applied when the page is loaded.
75
+
Otherwise, PurgeCSS will assume that any classes related to dark mode should be removed, as the `mode-dark` class is only applied when the page is loaded.
0 commit comments