Skip to content

Commit ce1ff60

Browse files
Add Tailwind v4 custom color theme example to README
1 parent 25051fb commit ce1ff60

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,47 @@ Note that you can't nest new `prose` instances within a `not-prose` block at thi
247247

248248
### Adding custom color themes
249249

250-
To customize the color theme beyond simple CSS overrides, you can use the JavaScript based theme API. To do that, use the `@config` directive:
250+
To customize the color theme beyond simple CSS overrides, you can add a `@utility` directive to your CSS file.
251+
252+
```css
253+
@utility prose-pink {
254+
--tw-prose-body: var(--color-pink-800);
255+
--tw-prose-headings: var(--color-pink-900);
256+
--tw-prose-lead: var(--color-pink-700);
257+
--tw-prose-links: var(--color-pink-900);
258+
--tw-prose-bold: var(--color-pink-900);
259+
--tw-prose-counters: var(--color-pink-600);
260+
--tw-prose-bullets: var(--color-pink-400);
261+
--tw-prose-hr: var(--color-pink-300);
262+
--tw-prose-quotes: var(--color-pink-900);
263+
--tw-prose-quote-borders: var(--color-pink-300);
264+
--tw-prose-captions: var(--color-pink-700);
265+
--tw-prose-code: var(--color-pink-900);
266+
--tw-prose-pre-code: var(--color-pink-100);
267+
--tw-prose-pre-bg: var(--color-pink-900);
268+
--tw-prose-th-borders: var(--color-pink-300);
269+
--tw-prose-td-borders: var(--color-pink-200);
270+
--tw-prose-invert-body: var(--color-pink-200);
271+
--tw-prose-invert-headings: var(--color-white);
272+
--tw-prose-invert-lead: var(--color-pink-300);
273+
--tw-prose-invert-links: var(--color-white);
274+
--tw-prose-invert-bold: var(--color-white);
275+
--tw-prose-invert-counters: var(--color-pink-400);
276+
--tw-prose-invert-bullets: var(--color-pink-600);
277+
--tw-prose-invert-hr: var(--color-pink-700);
278+
--tw-prose-invert-quotes: var(--color-pink-100);
279+
--tw-prose-invert-quote-borders: var(--color-pink-700);
280+
--tw-prose-invert-captions: var(--color-pink-400);
281+
--tw-prose-invert-code: var(--color-white);
282+
--tw-prose-invert-pre-code: var(--color-pink-300);
283+
--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);
284+
--tw-prose-invert-th-borders: var(--color-pink-600);
285+
--tw-prose-invert-td-borders: var(--color-pink-700);
286+
}
287+
```
288+
289+
290+
For Tailwind v3, you can use the JavaScript based theme API. To do that, use the `@config` directive:
251291

252292
```diff
253293
@import "tailwindcss";

0 commit comments

Comments
 (0)