Skip to content

Commit bda7b9a

Browse files
committed
docs: update readme about theme
1 parent fba002a commit bda7b9a

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,40 @@ plugins: [
191191

192192
</details>
193193

194-
Then you can wrap you HTML elements with `themeable-example-theme` class to use the `example-theme` theme! All `text-themeable-*` class uses the CSS variable from the generated CSS of your configuration. `tailwindcss-themeable` already has two built-in themes (`dracula` and `material`) you can use directly.
194+
Then you can wrap you HTML elements with `themeable-example-theme` class to use the `example-theme` theme! All `text-themeable-*`, `bg-themeable-*`, and so on... classes use the CSS variable from the generated CSS of your configuration. `tailwindcss-themeable` already has two built-in themes (`dracula` and `material`) you can use directly.
195195

196196
```html
197197
<div class="themeable-example-theme">
198-
<div class="text-themeable-foreground">
198+
<div class="text-themeable-foreground bg-themeable-background">
199199
Hello world!
200200
</div>
201201
</div>
202202
<div class="themeable-dracula">
203-
<div class="text-themeable-foreground">
203+
<div class="text-themeable-foreground bg-themeable-background">
204204
Hello world!
205205
</div>
206206
</div>
207207
<div class="themeable-material">
208-
<div class="text-themeable-foreground">
208+
<div class="text-themeable-foreground bg-themeable-background">
209209
Hello world!
210210
</div>
211211
</div>
212212
```
213213

214+
Compiled CSS:
215+
216+
```css
217+
.text-themeable-foreground {
218+
--tw-text-opacity: 1;
219+
color: rgba(var(--themeable-foreground), var(--tw-text-opacity));
220+
}
221+
222+
.bg-themeable-background {
223+
--tw-bg-opacity: 1;
224+
background-color: rgba(var(--themeable-background), var(--tw-bg-opacity));
225+
}
226+
```
227+
214228
<hr>
215229

216230
You can specify all the shades of a color if you want:

examples/windi/windi.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default defineConfig({
66
themeable({
77
themes: [
88
{
9-
name: 'one-dark-pro',
9+
name: 'example-theme',
1010
palette: {
1111
background: '#282A36',
1212
foreground: '#F8F8F2',

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
"version": "1.0.0",
44
"description": "multiple themes support for tailwindcss, with Dracula built-in",
55
"main": "dist/index.js",
6+
"module": "dist/index.mjs",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1",
89
"build": "tsup",
910
"dev": "tsup --watch src",
1011
"prepare": "husky install"
1112
},
13+
"files": [
14+
"dist",
15+
"src"
16+
],
1217
"repository": {
1318
"type": "git",
1419
"url": "git+https://github.com/upupming/tailwindcss-themeable.git"

0 commit comments

Comments
 (0)