@ilijazm/tailwindcss-semantic-palette 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -14
- package/dist/index.js +3471 -1
- package/dist/index.js.map +4 -4
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -13,13 +13,13 @@ instead of specific color values such as `indigo`, `green`, or `yellow`.
|
|
|
13
13
|
1. [Installation](#1-installation)
|
|
14
14
|
2. [Features](#2-features)
|
|
15
15
|
3. [Customization](#3-customization)
|
|
16
|
+
4. [Contributions](#4-contributions)
|
|
17
|
+
5. [Further information](#5-further-information)
|
|
16
18
|
|
|
17
19
|
## 1. Installation
|
|
18
20
|
|
|
19
21
|
To install the TailwindCSS Semantic Palette follow the following steps:
|
|
20
22
|
|
|
21
|
-

|
|
22
|
-
|
|
23
23
|
1. Install the TailwindCSS Semantic Palette dependency:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
@@ -33,15 +33,12 @@ npm install @ilijazm/tailwindcss-semantic-palette
|
|
|
33
33
|
+ @plugin "@ilijazm/tailwindcss-semantic-palette";
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
37
36
|
## 2. Features
|
|
38
37
|
|
|
39
38
|
### Default palette extension
|
|
40
39
|
|
|
41
40
|
By default, the plugin adds the following colors to the TailwindCSS palette:
|
|
42
41
|
|
|
43
|
-

|
|
44
|
-
|
|
45
42
|
* `surface`
|
|
46
43
|
* `container`
|
|
47
44
|
* `content`
|
|
@@ -55,6 +52,38 @@ By default, the plugin adds the following colors to the TailwindCSS palette:
|
|
|
55
52
|
* `warning`
|
|
56
53
|
* `danger`
|
|
57
54
|
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
### Automatic shade generation
|
|
58
|
+
|
|
59
|
+
Color shades can be automatically generated.
|
|
60
|
+
That means that one color is enough to generate the full tailwindcss shades from 50 to 950.
|
|
61
|
+
|
|
62
|
+
This example demonstrates how the user can customize the `brand`-color to a automatically generated shade
|
|
63
|
+
based on the color `#2fd077`:
|
|
64
|
+
|
|
65
|
+
```css
|
|
66
|
+
@import 'tailwindcss';
|
|
67
|
+
|
|
68
|
+
/* The color shades from 50 to 950 are automatically generated */
|
|
69
|
+
@plugin '@IlijazM/tailwindcss-semantic-palette' {
|
|
70
|
+
semantic-palette--brand: "#2fd077";
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This is _roughtly_ equivalent to the following configuration:
|
|
75
|
+
|
|
76
|
+
```css
|
|
77
|
+
@import 'tailwindcss';
|
|
78
|
+
|
|
79
|
+
/* The color shades from 50 to 950 are automatically generated */
|
|
80
|
+
@plugin '@IlijazM/tailwindcss-semantic-palette' {
|
|
81
|
+
semantic-palette--brand: "#ecfbf3", "#c6f2da", "#a0eac1", "#7be1a9", "#55d990", "#2fd077", "#26aa62", "#1e844c", "#155f36", "#0d3921", "#04130b";
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
For more information on that read the section [Customize a color](#customize-a-color).
|
|
86
|
+
|
|
58
87
|
## 3. Customization
|
|
59
88
|
|
|
60
89
|
TailwindCSS Semantic Palette is build to support a wide range of customization options:
|
|
@@ -114,9 +143,11 @@ This yields the following result:
|
|
|
114
143
|
|
|
115
144
|

|
|
116
145
|
|
|
117
|
-
Alternatively,
|
|
146
|
+
Alternatively, one can either define an array of colors to specify the exact colors
|
|
147
|
+
or specify a single color and generate the shades automatically.
|
|
148
|
+
|
|
118
149
|
This array must contain exactly 11 items since TailwindCSS has 11 shades for each color
|
|
119
|
-
(50, 100, 200, ..., 800, 900, 950)
|
|
150
|
+
`(50, 100, 200, ..., 800, 900, 950)`.
|
|
120
151
|
|
|
121
152
|
For example, a user wants to set the exact `brand` color.
|
|
122
153
|
|
|
@@ -135,29 +166,59 @@ This yields the following result:
|
|
|
135
166
|
|
|
136
167
|

|
|
137
168
|
|
|
169
|
+
Alternatively, one can specify a single color and let the shades get generated automatically
|
|
170
|
+
like in the following example:
|
|
171
|
+
|
|
172
|
+
```css
|
|
173
|
+
@import 'tailwindcss';
|
|
174
|
+
|
|
175
|
+
/* Extends the palette with all the default colors but set a custom brand color */
|
|
176
|
+
@plugin '@IlijazM/tailwindcss-semantic-palette' {
|
|
177
|
+
semantic-palette--brand: "#2fd077";
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
138
181
|
### Select a subset of colors and customize colors
|
|
139
182
|
|
|
140
|
-
To select a subset of colors while customizing the colors
|
|
183
|
+
To select a subset of colors while customizing the colors one can use the `semantic-palette` option
|
|
184
|
+
whiles also using the `semantic-palette--<color_name>` options.
|
|
185
|
+
|
|
186
|
+
Selecting a subset of colors whiles customizing colors is useful to control, limit, and customize the set of colors
|
|
187
|
+
that gets added to the project.
|
|
188
|
+
For example, a user only needs to add the colors `primary` and `brand` to the palette
|
|
189
|
+
whiles also setting a custom `brand`-color.
|
|
190
|
+
|
|
191
|
+
The following code demonstrates how the user is able to select a subset of colors
|
|
192
|
+
whiles also customizing the `brand`-color:
|
|
141
193
|
|
|
142
194
|
```css
|
|
143
195
|
@import 'tailwindcss';
|
|
144
196
|
|
|
145
|
-
/* Only extend the palette with 'primary', 'brand', and 'warning' and customize the
|
|
197
|
+
/* Only extend the palette with 'primary', 'brand', and 'warning' and customize the color 'brand'. */
|
|
146
198
|
@plugin '@IlijazM/tailwindcss-semantic-palette' {
|
|
147
199
|
semantic-palette: primary, brand, warning;
|
|
148
|
-
semantic-palette--brand: "#
|
|
200
|
+
semantic-palette--brand: "#2fd077";
|
|
149
201
|
}
|
|
150
202
|
```
|
|
151
203
|
|
|
152
204
|
### Use custom colors exclusively
|
|
153
205
|
|
|
206
|
+
The select custom colors exclusively one can use the `semantic-palette` option and set custom color names
|
|
207
|
+
that later get specified using the `semantic-palette--<color_name>` options.
|
|
208
|
+
|
|
209
|
+
Using custom colors exclusively is useful if the project requires very specific colors
|
|
210
|
+
while not needing the default colors provided by the plugin.
|
|
211
|
+
For example one could develop a kanban-board that requires shades for the colors `to-do`, `in-progress`, and `done`.
|
|
212
|
+
|
|
213
|
+
The following code demonstrated how the user is able to use custom colors exclusively:
|
|
214
|
+
|
|
154
215
|
```css
|
|
155
216
|
@import 'tailwindcss';
|
|
156
217
|
|
|
157
218
|
/* Only extend the palette with the custom colors 'to-do', 'in-progress', and 'done' */
|
|
158
219
|
@plugin '@IlijazM/tailwindcss-semantic-palette' {
|
|
159
220
|
semantic-palette: to-do, in-progress, done;
|
|
160
|
-
semantic-palette--to-do: "#
|
|
221
|
+
semantic-palette--to-do: "#2fd077";
|
|
161
222
|
semantic-palette--in-progress: "var(--color-sky-*)";
|
|
162
223
|
semantic-palette--done: "hsl(260, 13%, 95%)", "hsl(262, 11%, 86%)", "hsl(260, 10%, 77%)", "hsl(260, 11%, 68%)", "hsl(261, 11%, 59%)", "hsl(261, 11%, 50%)", "hsl(261, 11%, 41%)", "hsl(263, 11%, 32%)", "hsl(263, 11%, 23%)", "hsl(263, 11%, 14%)", "hsl(260, 13%, 5%)"
|
|
163
224
|
}
|
|
@@ -193,6 +254,10 @@ To select a subset of colors while customizing the colors
|
|
|
193
254
|
}
|
|
194
255
|
```
|
|
195
256
|
|
|
257
|
+
## 4. Contributions
|
|
258
|
+
|
|
259
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
260
|
+
|
|
196
261
|
### Build project
|
|
197
262
|
|
|
198
263
|
1. Install dependencies with `npm install`
|
|
@@ -206,10 +271,16 @@ To select a subset of colors while customizing the colors
|
|
|
206
271
|
1. Run development build with `npm run dev`
|
|
207
272
|
1. Check the example via `http://localhost:5173/`
|
|
208
273
|
|
|
209
|
-
##
|
|
274
|
+
## 5. Further information
|
|
210
275
|
|
|
211
|
-
|
|
276
|
+
### Dependencies
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
.
|
|
280
|
+
├── 📦 culori
|
|
281
|
+
└── 📦 tailwindcss
|
|
282
|
+
```
|
|
212
283
|
|
|
213
|
-
|
|
284
|
+
### License
|
|
214
285
|
|
|
215
286
|
[MIT](../LICENSE)
|