Skip to content

Commit 0049c73

Browse files
Add Tailwind v4 custom color theme example to README (#396)
* Add Tailwind v4 custom color theme example to README * Small fixes --------- Co-authored-by: Philipp Spiess <[email protected]>
1 parent 5134cc8 commit 0049c73

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

README.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,46 @@ Even when using a prefix for your utilities `not-prose` should not have a prefix
252252

253253
### Adding custom color themes
254254

255-
To customize the color theme beyond simple CSS overrides, you can use the JavaScript based theme API. To do that, use the `@config` directive:
255+
To customize the color theme beyond simple CSS overrides, add a `@utility` directive to your CSS file:
256256

257-
```diff
258-
@import "tailwindcss";
259-
@plugin "@tailwindcss/typography";
260-
+ @config "./tailwind.config.js";
257+
```css
258+
@utility prose-pink {
259+
--tw-prose-body: var(--color-pink-800);
260+
--tw-prose-headings: var(--color-pink-900);
261+
--tw-prose-lead: var(--color-pink-700);
262+
--tw-prose-links: var(--color-pink-900);
263+
--tw-prose-bold: var(--color-pink-900);
264+
--tw-prose-counters: var(--color-pink-600);
265+
--tw-prose-bullets: var(--color-pink-400);
266+
--tw-prose-hr: var(--color-pink-300);
267+
--tw-prose-quotes: var(--color-pink-900);
268+
--tw-prose-quote-borders: var(--color-pink-300);
269+
--tw-prose-captions: var(--color-pink-700);
270+
--tw-prose-code: var(--color-pink-900);
271+
--tw-prose-pre-code: var(--color-pink-100);
272+
--tw-prose-pre-bg: var(--color-pink-900);
273+
--tw-prose-th-borders: var(--color-pink-300);
274+
--tw-prose-td-borders: var(--color-pink-200);
275+
--tw-prose-invert-body: var(--color-pink-200);
276+
--tw-prose-invert-headings: var(--color-white);
277+
--tw-prose-invert-lead: var(--color-pink-300);
278+
--tw-prose-invert-links: var(--color-white);
279+
--tw-prose-invert-bold: var(--color-white);
280+
--tw-prose-invert-counters: var(--color-pink-400);
281+
--tw-prose-invert-bullets: var(--color-pink-600);
282+
--tw-prose-invert-hr: var(--color-pink-700);
283+
--tw-prose-invert-quotes: var(--color-pink-100);
284+
--tw-prose-invert-quote-borders: var(--color-pink-700);
285+
--tw-prose-invert-captions: var(--color-pink-400);
286+
--tw-prose-invert-code: var(--color-white);
287+
--tw-prose-invert-pre-code: var(--color-pink-300);
288+
--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);
289+
--tw-prose-invert-th-borders: var(--color-pink-600);
290+
--tw-prose-invert-td-borders: var(--color-pink-700);
291+
}
261292
```
262293

263-
You can then create your own color theme by adding a new `tailwind.config.js` file with the `typography` section and providing your colors under the `css` key:
294+
For Tailwind v3, update the `typography` section in the JavaScript config file and provide your colors under the `css` key:
264295

265296
```js {{ filename: 'tailwind.config.js' }}
266297
/** @type {import('tailwindcss').Config} */
@@ -341,7 +372,15 @@ Now every instance of `prose` in the default class names will be replaced by you
341372

342373
### Customizing the CSS
343374

344-
If you want to customize the raw CSS generated by this plugin, first follow the steps from [adding custom color themes](#adding-custom-color-themes) to set up a JavaScript based configuration API and then add your overrides under the `typography` key in the `theme` section of your `tailwind.config.js` file:
375+
If you want to customize the raw CSS generated by this plugin, you can use the JavaScript based theme API. To do that, use the `@config` directive:
376+
377+
```diff
378+
@import "tailwindcss";
379+
@plugin "@tailwindcss/typography";
380+
+ @config "./tailwind.config.js";
381+
```
382+
383+
You can then create your own config by adding a new `tailwind.config.js` file with the `typography` section and providing your styles under the `css` key:
345384

346385
```js {{ filename: 'tailwind.config.js' }}
347386
/** @type {import('tailwindcss').Config} */

0 commit comments

Comments
 (0)