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
+61-3Lines changed: 61 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,9 @@ module.exports = {
28
28
require('@fylgja/tailwindcss-plugin-cssprops')({
29
29
tokens: {
30
30
colors: {
31
-
primary:"200 50% 50%"// HSL color syntax
31
+
primary: {
32
+
DEFAULT:"200 50% 50%"// HSL color syntax
33
+
}
32
34
},
33
35
},
34
36
}),
@@ -43,6 +45,8 @@ module.exports = {
43
45
To take it a step further, you can also add your tokens to TailwindCSS colors:
44
46
45
47
```js
48
+
constcolors=require("@fylgja/colors/hsl");
49
+
46
50
module.exports= {
47
51
theme: {
48
52
extend: {
@@ -58,8 +62,8 @@ module.exports = {
58
62
tokens: {
59
63
colors: {
60
64
primary: {
61
-
DEFAULT:"200 50% 50%"// HSL color syntax
62
-
}
65
+
DEFAULT:colors.purple[8],
66
+
},
63
67
},
64
68
},
65
69
}),
@@ -70,3 +74,57 @@ module.exports = {
70
74
Now you can use it as `bg-primary`.
71
75
72
76
For more information on how to use CSS variables in TailwindCSS, refer to the [TailwindCSS docs on using CSS variables](https://tailwindcss.com/docs/customizing-colors#using-css-variables).
77
+
78
+
### Dark Mode
79
+
80
+
This plugin fully supports dark mode, just like TailwindCSS. The difference is that you no longer need to define the utilities in your HTML.
81
+
82
+
To use dark mode tokens, add the key `@media:dark` to your tokens. Anything inside this key will automatically use the dark mode media query.
83
+
84
+
```js
85
+
module.exports= {
86
+
theme: {
87
+
extend: {
88
+
// ...
89
+
}
90
+
},
91
+
plugins: [
92
+
require('@fylgja/tailwindcss-plugin-cssprops')({
93
+
tokens: {
94
+
colors: {
95
+
primary: {
96
+
DEFAULT:"200 50% 50%"// HSL color syntax
97
+
},
98
+
"primary-@media:dark": {
99
+
DEFAULT:"200 50% 50%"// HSL color syntax
100
+
},
101
+
// Or use a wrapper as long as the media key is part of the group key, like "colors"
102
+
"@media:dark": {
103
+
primary: {
104
+
DEFAULT:"200 50% 50%"// HSL color syntax
105
+
}
106
+
}
107
+
},
108
+
},
109
+
}),
110
+
],
111
+
}
112
+
```
113
+
114
+
If you prefer to use a different class or selector, you can configure it using the `darkmode` option:
115
+
116
+
```js
117
+
module.exports= {
118
+
// ...
119
+
plugins: [
120
+
require("@fylgja/tailwindcss-plugin-cssprops")({
121
+
tokens: {
122
+
// ...
123
+
},
124
+
darkmode:"[data-theme=dark]"
125
+
})
126
+
]
127
+
}
128
+
```
129
+
130
+
Feel free to customize the `darkmode` option based on your specific needs and existing CSS classes or selectors.
0 commit comments