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
Copy file name to clipboardExpand all lines: README.md
+54-7Lines changed: 54 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Similar to the tailwindcss configurations you are used to. It is also possible t
20
20
- Variables can be formed through using nested object notation.
21
21
- Different variables can be composed for the Dark Mode.
22
22
- Dark Mode variables are set automatically through the `class` or `media` modes on your configuration.
23
-
-If `darkMode` config are set as `class`, custom dark selector can be defined.
23
+
-Dark Mode custom selector is inherited from [Tailwind configuration](https://tailwindcss.com/docs/dark-mode#customizing-the-class-name)
24
24
- It allows you to add custom themes while creating your own plugin via the plugin API.
25
25
- Prefix can be defined for variables. (It is useful when using the plugin API)
26
26
- You can configure your own needs such as multi-themes without needing an additional plugin!
@@ -176,22 +176,70 @@ module.exports = {
176
176
}
177
177
```
178
178
179
-
#### with the `darkToRoot` and `darkSelector` configurations
179
+
#### Custom dark selector
180
180
181
-
If the `darkMode`configuration is set as `'class'` in your tailwindcss configuration, you can change and customize the `darkToRoot` and `darkSelector` settings.
181
+
Note that the plugin will use your custom selector if [enabled in your Tailwind configuration](https://tailwindcss.com/docs/dark-mode#customizing-the-class-name).
182
+
183
+
```javascript
184
+
// tailwind.config.js
185
+
186
+
module.exports= {
187
+
188
+
darkMode: ['class', '.custom-dark-selector'],
189
+
190
+
theme: {
191
+
variables: {
192
+
DEFAULT: {
193
+
colors: {
194
+
red: {
195
+
50:'red',
196
+
},
197
+
},
198
+
},
199
+
},
200
+
darkVariables: {
201
+
DEFAULT: {
202
+
colors: {
203
+
red: {
204
+
50:'blue',
205
+
},
206
+
},
207
+
},
208
+
},
209
+
},
210
+
plugins: [
211
+
require('@mertasan/tailwindcss-variables')
212
+
]
213
+
}
214
+
```
215
+
216
+
**Output:**
217
+
218
+
```css
219
+
:root {
220
+
--colors-red-50: red
221
+
}
222
+
223
+
:root.custom-dark-selector {
224
+
--colors-red-50: blue
225
+
}
226
+
```
227
+
228
+
#### with the `darkToRoot` configuration
229
+
230
+
If the `darkMode` configuration is set as `'class'` in your tailwindcss configuration, you can change and customize the `darkToRoot` setting.
0 commit comments