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
+57-16
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,30 @@
1
1
# tailwindcss-themeable
2
2
3
-
Adds multiple themes support for Tailwind CSS and Windi CSS.
4
-
5
-
You can just develop your app with one theme and it will work with multiple themes palette colors, all you need is just to specify your default (for shade `500`) color values for your theme pallette. We will generate all shades from `50` to `900` for you, following the built-in shade name convention of the [default color values](https://tailwindcss.com/docs/customizing-colors).
Adds multiple themes support for Tailwind CSS and Windi CSS.
10
13
11
-
Demo Link:
14
+
You can just develop your app with one theme and it will work with multiple themes color palettes, all you need is just to specify your default (for shade `500`) color values for your theme pallette. We will generate all shades from `50` to `900` for you, following the built-in shade name convention of the [default color values](https://tailwindcss.com/docs/customizing-colors).
We define the color names following [the dracula contribute color palette](https://draculatheme.com/contribute).
37
+
We define the color palette keys following [the dracula contribute color palette](https://draculatheme.com/contribute).
30
38
31
39
CSS variables are generated from build time, and added to the corresponding scope for usage.
32
40
@@ -43,6 +51,7 @@ plugins: [
43
51
{
44
52
name: 'example-theme',
45
53
palette: {
54
+
// color palette key: hex code
46
55
background: '#282A36',
47
56
foreground: '#F8F8F2',
48
57
selection: '#44475A',
@@ -227,9 +236,13 @@ Compiled CSS:
227
236
}
228
237
```
229
238
230
-
<hr>
239
+
## Override auto-generated shade values
231
240
232
-
You can specify all the shades of a color if you want:
241
+
As the [tailwindcss docs says](https://tailwindcss.com/docs/customizing-colors#generating-colors):
242
+
243
+
> Bad news, color is complicated and despite trying dozens of different tools, we’ve yet to find one that does a good job generating these sorts of color palettes. We picked all of Tailwind’s default colors by hand, meticulously balancing them by eye and testing them in real designs to make sure we were happy with them.
244
+
245
+
You can specify all (or just a part of) the shades of a color if you want, this will overwrite the auto-generated shade value. It will be super useful if you find the auto-generated not satisfying. Below is an example configuration, you can explore more on the [`override-shades`](examples/override-shades) example:
233
246
234
247
```js
235
248
themeable({
@@ -257,7 +270,35 @@ themeable({
257
270
})
258
271
```
259
272
260
-
Extra configurations:
273
+
## Customized palette keys
274
+
275
+
You may find the dracula theme's palette key is not satisfying, and you may like some name convention such as `primary`, `secondary`, etc., just like [the material ui does](https://mui.com/customization/palette/). No problem, you can pass any key you want, but be cautious that you must define the `primary` key for all your themes to avoid the problem of missing a color when switching themes. The plugin will log a warning message if you forget some keys in a theme. Below is an example configuration, you can explore more on the [`customized-palette-keys`](examples/customized-palette-keys) example:
276
+
277
+
```js
278
+
themeable({
279
+
themes: [
280
+
{
281
+
name:'theme-1',
282
+
palette: {
283
+
primary:'#42a5f5'
284
+
//...
285
+
}
286
+
},
287
+
{
288
+
name:'theme-2',
289
+
palette: {
290
+
// make sure all your themes have your customized keys to avoid problems when switching themes
291
+
primary:'#fcba03'
292
+
//...
293
+
}
294
+
}
295
+
]
296
+
})
297
+
```
298
+
299
+
## Full configurations
300
+
301
+
This is the type definition of this plugin, you can dive into the source code to see more, all the type definitions are well documented for your convenience. If you have any questions, please fell free to open an issue.
0 commit comments