|
2 | 2 |
|
3 | 3 | [![github.actions.changeset.badge]][github.actions.changeset] [![codecov.badge]][codecov] [![MIT][license.badge]][license] [![npm.badge]][npm] |
4 | 4 |
|
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [postcss-color-scheme](#postcss-color-scheme) |
| 8 | + - [Table of Contents](#table-of-contents) |
| 9 | + - [Changelog](#changelog) |
| 10 | + - [Installation](#installation) |
| 11 | + - [Design Decisions](#design-decisions) |
| 12 | + - [Supported At Rules](#supported-at-rules) |
| 13 | + - [Global Variant](#global-variant) |
| 14 | + - [Test Cases \& Examples](#test-cases--examples) |
| 15 | + - [Tailwind Support](#tailwind-support) |
| 16 | + |
5 | 17 | ## [Changelog][changelog] |
6 | 18 |
|
7 | | -Postcss plugin for handling `prefers-color-scheme` |
| 19 | +Postcss plugin for handling `prefers-color-scheme`, plus [tailwind support](#tailwind-support) |
8 | 20 |
|
9 | 21 | Input |
10 | 22 |
|
@@ -140,6 +152,31 @@ The following table lists test cases covered by this plugin, please refer to [te |
140 | 152 | | with [postcss-nesting] | `.my-class { & .nested { @dark { color: white } } }` | [input][tests.with-postcss-nesting.input] | [output][tests.with-postcss-nesting.output] | |
141 | 153 | | with [postcss-nested] | `.my-class { .nested { @dark { color: white } } }` | [input][tests.with-postcss-nested.input] | [output][tests.with-postcss-nested.output] | |
142 | 154 |
|
| 155 | +## Tailwind Support |
| 156 | + |
| 157 | +Make sure you have installed and configured `tailwindcss`. |
| 158 | + |
| 159 | +```bash |
| 160 | +npm install --save-dev tailwindcss |
| 161 | +``` |
| 162 | + |
| 163 | +Add `postcss-color-scheme` to your tailwind config as a plugin, and turn off the default `darkMode` handling. |
| 164 | + |
| 165 | +```js |
| 166 | +/** @type {import("tailwindcss").Config } */ |
| 167 | +module.exports = { |
| 168 | + // your config ... |
| 169 | + darkMode: '', |
| 170 | + plugins: [require('postcss-color-scheme/tailwind')], |
| 171 | +}; |
| 172 | +``` |
| 173 | + |
| 174 | +Now, the following is available: |
| 175 | + |
| 176 | +```html |
| 177 | +<input class="text-white dark:text-black light:border-gray-500"> |
| 178 | +``` |
| 179 | + |
143 | 180 | [changelog]: ./CHANGELOG.md |
144 | 181 | [tests]: https://github.com/vnphanquang/postcss-color-scheme/blob/main/src/color-scheme.test.js |
145 | 182 |
|
@@ -169,3 +206,4 @@ The following table lists test cases covered by this plugin, please refer to [te |
169 | 206 |
|
170 | 207 | [postcss-nesting]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting |
171 | 208 | [postcss-nested]: https://github.com/postcss/postcss-nested |
| 209 | +[tailwind]: https://tailwindcss.com/ |
0 commit comments