22
33![ tailwind] ( /docs/example.png )
44
5- A plugin for Tailwind CSS that automatically generates color palettes from base colors. Developed specifically for Tailwind CSS v4.
5+ ** Tailwindcss Palette Generator ** is an easy-to-use extension that allows you to automatically create a complete color palette from a single base color in your Tailwind CSS project. Specifically designed for Tailwind CSS v4, it significantly simplifies color management .
66
7- ## 🎉 Installation
8-
9- pnpm
7+ ## Why Use This Extension?
108
11- > pnpm add -D tailwindcss-palette-generator@latest
9+ - ✅ Automatically generate your entire color palette from a single base color
10+ - ✅ Different shade levels (50-900) for consistent visual design
11+ - ✅ Full compatibility with Tailwind CSS v4
12+ - ✅ Quick integration with minimal configuration
1213
13- yarn
14+ ## 🎉 Installation
1415
15- > yarn add --dev tailwindcss-palette-generator@latest
16+ ``` bash
17+ # using pnpm
18+ pnpm add -D tailwindcss-palette-generator@latest
1619
17- npm
20+ # using yarn
21+ yarn add --dev tailwindcss-palette-generator@latest
1822
19- > npm i --save-dev tailwindcss-palette-generator@latest
23+ # using npm
24+ npm i --save-dev tailwindcss-palette-generator@latest
25+ ```
2026
2127[ ![ npm version] ( https://badge.fury.io/js/tailwindcss-palette-generator.svg )] ( https://badge.fury.io/js/tailwindcss-palette-generator )
2228![ NPM] ( https://img.shields.io/npm/l/tailwindcss-palette-generator )
2632![ npm] ( https://img.shields.io/npm/dw/tailwindcss-palette-generator )
2733![ GitHub top language] ( https://img.shields.io/github/languages/top/ibodev1/tailwindcss-palette-generator )
2834
29- ## 👀 Usage
35+ ## 👀 Basic Usage
3036
31- This plugin works with Tailwind CSS v4. Add it to your CSS file :
37+ Easily define the extension in your CSS file and specify your base colors :
3238
3339``` css
3440@import " tailwindcss" ;
@@ -39,13 +45,72 @@ This plugin works with Tailwind CSS v4. Add it to your CSS file:
3945}
4046```
4147
42- This will automatically generate color palettes for your primary and secondary colors with shades ranging from 50 to 900.
48+ With this definition, you can now use your color palettes with shade levels from 50 to 900:
4349
4450```html
4551<div class="bg-primary-500 "> Primary color</div >
46- <div class="text-secondary-700 "> Secondary color with darker shade</div >
52+ <div class="text-secondary-700 "> Secondary color (dark shade)</div >
53+ ```
54+
55+ ## 💡 Advanced Usage
56+
57+ ### Programmatic Usage with JavaScript/TypeScript
58+
59+ You can also generate color palettes programmatically:
60+
61+ ```ts
62+ import { getPalette } from 'tailwindcss-palette-generator /getPalette';
63+
64+ // Create palette with custom options
65+ const palette = getPalette([
66+ {
67+ color: " rgb(255, 189, 0)" , // required
68+ name: " primary" , // required
69+ shade: 400
70+ },
71+ {
72+ color: " rgba(255, 189, 0, 1)" , // required
73+ name: " secondary" , // required
74+ shade: 500
75+ },
76+ {
77+ color: " hsl(44, 100%, 50%)" , // required
78+ name: " tertiary" , // required
79+ shade: 600
80+ },
81+ {
82+ color: " #FFBD00" , // required
83+ name: " quaternary" , // required
84+ shade: 300, // you will set shades is mandatory
85+ shades: [100, 200, 300, 400, 500]
86+ }
87+ ]);
88+
89+ console.log(palette);
90+ ```
91+
92+ ### Usage with Tailwind Config File
93+
94+ ```js
95+ import { getPalette } from 'tailwindcss-palette-generator /getPalette';
96+
97+ const palette = getPalette({
98+ color : " #FFBD00" , // required
99+ name: " primary" , // required
100+ shade: 300 , // you will set shaders is mandatory
101+ shades: [100 , 200 , 300 , 400 , 500 ]
102+ });
103+
104+ export default {
105+ // ...other configurations
106+ theme : {
107+ extend: {
108+ colors: palette
109+ }
110+ }
111+ }
47112```
48113
49114## 🚀 Dependencies
50115
51- - [chroma.js ](https://gka.github .io/chroma.js/) - Color manipulation library
116+ - [ chroma.js] ( https://gka.github.io/chroma.js/ ) - Library used for color manipulation
0 commit comments