@ilijazm/tailwindcss-semantic-palette 0.1.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 ADDED
@@ -0,0 +1,215 @@
1
+ # TailwindCSS Semantic Palette
2
+
3
+ TailwindCSS Semantic Palette is a highly extendable plugin for Tailwind CSS
4
+ that extends the default color palette with colors with semantic meaning.
5
+ This allows the user to reference colors by their intended meaning such as `primary`, `success`, or `warning`
6
+ instead of specific color values such as `indigo`, `green`, or `yellow`.
7
+
8
+ ![Introduction](docs/images/readme_introduction.png)
9
+
10
+
11
+ **Table of content**
12
+
13
+ 1. [Installation](#1-installation)
14
+ 2. [Features](#2-features)
15
+ 3. [Customization](#3-customization)
16
+
17
+ ## 1. Installation
18
+
19
+ To install the TailwindCSS Semantic Palette follow the following steps:
20
+
21
+ ![Installation Guide](docs/images/installation.png)
22
+
23
+ 1. Install the TailwindCSS Semantic Palette dependency:
24
+
25
+ ```bash
26
+ npm install @ilijazm/tailwindcss-semantic-palette
27
+ ```
28
+
29
+ 2. Import the plugin in your `.css`-file.
30
+
31
+ ```diff
32
+ @import "tailwindcss";
33
+ + @plugin "@ilijazm/tailwindcss-semantic-palette";
34
+ ```
35
+
36
+
37
+ ## 2. Features
38
+
39
+ ### Default palette extension
40
+
41
+ By default, the plugin adds the following colors to the TailwindCSS palette:
42
+
43
+ ![Default colors](docs/images/default_colors.png)
44
+
45
+ * `surface`
46
+ * `container`
47
+ * `content`
48
+ * `brand`
49
+ * `primary`
50
+ * `secondary`
51
+ * `tertiary`
52
+ * `accent`
53
+ * `info`
54
+ * `success`
55
+ * `warning`
56
+ * `danger`
57
+
58
+ ## 3. Customization
59
+
60
+ TailwindCSS Semantic Palette is build to support a wide range of customization options:
61
+
62
+ Skip to the desired content:
63
+
64
+ * [Select a subset of colors](#select-a-subset-of-colors)
65
+ * [Customize a color](#customize-a-color)
66
+ * [Select a subset of colors and customize colors](#select-a-subset-of-colors)
67
+ * [Use custom colors exclusively](#use-custom-colors-exclusively)
68
+ * [Add custom colors to a selected subset of colors](#add-custom-colors-to-a-selected-subset-of-colors)
69
+ * [Add custom colors to all default colors](#add-custom-colors-to-all-default-colors)
70
+
71
+ ### Select a subset of colors
72
+
73
+ To select only a subset of colors to add to the palette, one can use the `semantic-palette` option.
74
+ The `semantic-palette` option allows selecting a subset of colors.
75
+
76
+ Selecting a subset of colors is useful to control and limit the set of colors that gets added to the project.
77
+ For example, a user only needs to add the colors `primary` and `brand` to the palette.
78
+
79
+ The following code demonstrates how the user is able to select a subset of colors:
80
+
81
+ ```css
82
+ @import 'tailwindcss';
83
+
84
+ /* Only extend the palette with the default colors for 'primary' and 'brand'. */
85
+ @plugin '@IlijazM/tailwindcss-semantic-palette' {
86
+ semantic-palette: primary, brand;
87
+ }
88
+ ```
89
+
90
+ This yields the following result:
91
+
92
+ ![A subset of colors](docs/images/subset_of_colors.png)
93
+
94
+ ### Customize a color
95
+
96
+ To customize a color of the palette, one can use the `semantic-palette--<color_name>` options.
97
+ The `semantic-palette--<color_name>` option allows setting the color shades of a specific color.
98
+
99
+ Customizing a color is useful to apply the proper styling and branding to a project.
100
+ For example, a user wants to set the color `primary` to `rose`.
101
+
102
+ The following code demonstrates how the user is able to set the color `primary` to `rose`:
103
+
104
+ ```css
105
+ @import 'tailwindcss';
106
+
107
+ /* Extends the palette with all the default colors but set a custom primary color */
108
+ @plugin '@IlijazM/tailwindcss-semantic-palette' {
109
+ semantic-palette--primary: "var(--color-rose-*)";
110
+ }
111
+ ```
112
+
113
+ This yields the following result:
114
+
115
+ ![Customize primary](docs/images/customize_primary.png)
116
+
117
+ Alternatively, a user can define an array of colors to specify the exact colors.
118
+ This array must contain exactly 11 items since TailwindCSS has 11 shades for each color
119
+ (50, 100, 200, ..., 800, 900, 950).
120
+
121
+ For example, a user wants to set the exact `brand` color.
122
+
123
+ The following code demonstrates how the user is able to set the color `brand` to its exact color:
124
+
125
+ ```css
126
+ @import 'tailwindcss';
127
+
128
+ /* Extends the palette with all the default colors but set a custom brand color */
129
+ @plugin '@IlijazM/tailwindcss-semantic-palette' {
130
+ semantic-palette--brand: "#ecfbf3", "#c6f2da", "#a0eac1", "#7be1a9", "#55d990", "#2fd077", "#26aa62", "#1e844c", "#155f36", "#0d3921", "#04130b";
131
+ }
132
+ ```
133
+
134
+ This yields the following result:
135
+
136
+ ![Customize palette](docs/images/customize_brand.png)
137
+
138
+ ### Select a subset of colors and customize colors
139
+
140
+ To select a subset of colors while customizing the colors
141
+
142
+ ```css
143
+ @import 'tailwindcss';
144
+
145
+ /* Only extend the palette with 'primary', 'brand', and 'warning' and customize the colors 'primary' and 'brand'. */
146
+ @plugin '@IlijazM/tailwindcss-semantic-palette' {
147
+ semantic-palette: primary, brand, warning;
148
+ semantic-palette--brand: "#ecfbf3", "#c6f2da", "#a0eac1", "#7be1a9", "#55d990", "#2fd077", "#26aa62", "#1e844c", "#155f36", "#0d3921", "#04130b";
149
+ }
150
+ ```
151
+
152
+ ### Use custom colors exclusively
153
+
154
+ ```css
155
+ @import 'tailwindcss';
156
+
157
+ /* Only extend the palette with the custom colors 'to-do', 'in-progress', and 'done' */
158
+ @plugin '@IlijazM/tailwindcss-semantic-palette' {
159
+ semantic-palette: to-do, in-progress, done;
160
+ semantic-palette--to-do: "#ecfbf3", "#c6f2da", "#a0eac1", "#7be1a9", "#55d990", "#2fd077", "#26aa62", "#1e844c", "#155f36", "#0d3921", "#04130b";
161
+ semantic-palette--in-progress: "var(--color-sky-*)";
162
+ 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
+ }
164
+ ```
165
+
166
+ ### Add custom colors to a selected subset of colors
167
+
168
+ ```css
169
+ @import 'tailwindcss';
170
+
171
+ /* Extend the palette with colors for 'success' and 'error'
172
+ as well as the custom colors 'to-do', 'in-progress', and 'done' */
173
+ @plugin '@IlijazM/tailwindcss-semantic-palette' {
174
+ semantic-palette: success, error, to-do, in-progress, done;
175
+ semantic-palette--to-do: "#ecfbf3", "#c6f2da", "#a0eac1", "#7be1a9", "#55d990", "#2fd077", "#26aa62", "#1e844c", "#155f36", "#0d3921", "#04130b";
176
+ semantic-palette--in-progress: "var(--color-sky-*)";
177
+ 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%)"
178
+ }
179
+ ```
180
+
181
+ ### Add custom colors to all default colors
182
+
183
+ ```css
184
+ @import 'tailwindcss';
185
+
186
+ /* Extends the palette with all the default colors
187
+ as well as the custom colors 'to-do', 'in-progress', and 'done' */
188
+ @plugin '@IlijazM/tailwindcss-semantic-palette' {
189
+ semantic-palette: "*", to-do, in-progress, done;
190
+ semantic-palette--to-do: "#ecfbf3", "#c6f2da", "#a0eac1", "#7be1a9", "#55d990", "#2fd077", "#26aa62", "#1e844c", "#155f36", "#0d3921", "#04130b";
191
+ semantic-palette--in-progress: "var(--color-sky-*)";
192
+ 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%)"
193
+ }
194
+ ```
195
+
196
+ ### Build project
197
+
198
+ 1. Install dependencies with `npm install`
199
+ 1. Run `npm run build`
200
+ 1. Result is in the `dist/` directory
201
+
202
+ ### Run example
203
+
204
+ 1. Go into the directory `example/`
205
+ 1. Install dependencies with npm `install`
206
+ 1. Run development build with `npm run dev`
207
+ 1. Check the example via `http://localhost:5173/`
208
+
209
+ ## Contributions
210
+
211
+ Contributions are welcome! Please feel free to submit a Pull Request.
212
+
213
+ ## License
214
+
215
+ [MIT](../LICENSE)
package/dist/index.js ADDED
@@ -0,0 +1,296 @@
1
+ // node_modules/tailwindcss/dist/plugin.mjs
2
+ function g(i, n) {
3
+ return { handler: i, config: n };
4
+ }
5
+ g.withOptions = function(i, n = () => ({})) {
6
+ function t(o) {
7
+ return { handler: i(o), config: n(o) };
8
+ }
9
+ return t.__isOptionsFunction = true, t;
10
+ };
11
+ var u = g;
12
+
13
+ // src/palette/palette.ts
14
+ var Palette = class {
15
+ /**
16
+ * Constructs CSS variable declarations for all palette.
17
+ *
18
+ * Used for generating :root CSS variables in Tailwind CSS.
19
+ *
20
+ * Example output:
21
+ *
22
+ * ```typescript
23
+ * ["--color-primary-50: var(--color-indigo-50)", "--color-primary-100: var(--color-indigo-100)", ...]
24
+ * ```
25
+ *
26
+ * Example usage in CSS:
27
+ *
28
+ * ```typescript
29
+ * addBase({
30
+ * ':root': palette.cssDeclarations,
31
+ * });
32
+ * ```
33
+ *
34
+ * @return {string[]} Array of CSS variable declarations.
35
+ */
36
+ get cssDeclarations() {
37
+ return this.colors.map((color) => `--color-${color.name}-${color.shade}: ${color.value};`);
38
+ }
39
+ /**
40
+ * Constructs a nested theme object for all palette.
41
+ *
42
+ * Used for extending Tailwind CSS theme palette.
43
+ *
44
+ * Example output:
45
+ *
46
+ * ```typescript
47
+ * {
48
+ * primary: {
49
+ * "50": "var(--color-indigo-50)",
50
+ * "100": "var(--color-indigo-100)",
51
+ * ...
52
+ * },
53
+ * secondary: {
54
+ * "50": "var(--color-pink-50)",
55
+ * "100": "var(--color-pink-100)",
56
+ * ...
57
+ * },
58
+ * }
59
+ * ```
60
+ *
61
+ * Example usage in Tailwind CSS config:
62
+ *
63
+ * ```typescript
64
+ * return {
65
+ * theme: {
66
+ * extend: {
67
+ * palette: palette.themeExtension,
68
+ * },
69
+ * },
70
+ * };
71
+ * ```
72
+ *
73
+ * @return {Record<string, Record<string, string>>} Nested theme object.
74
+ */
75
+ get themeExtension() {
76
+ const theme = {};
77
+ for (const color of this.colors) {
78
+ if (!(color.name in theme)) {
79
+ theme[color.name] = {};
80
+ }
81
+ theme[color.name][color.shade] = color.value;
82
+ }
83
+ return theme;
84
+ }
85
+ colors = [];
86
+ /**
87
+ * Adds a new color to the collection.
88
+ *
89
+ * Example usage:
90
+ *
91
+ * ```typescript
92
+ * palette.addColor({ name: 'primary', shade: '500', value: 'var(--color-indigo-500)' });
93
+ * ```
94
+ *
95
+ * @param color {Color} The color to add.
96
+ */
97
+ addColor(color) {
98
+ this.colors.push(color);
99
+ }
100
+ };
101
+
102
+ // src/tailwindcss-color-shades.ts
103
+ var TAILWIND_COLORS_SHADES = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
104
+
105
+ // src/palette/generate-palette.ts
106
+ function generatePalette(options) {
107
+ const palette = new Palette();
108
+ const paletteEntries = Object.entries(options.semanticPalette);
109
+ for (const [semanticColorName, colorValues] of paletteEntries) {
110
+ if (colorValues.length !== TAILWIND_COLORS_SHADES.length) {
111
+ throw new Error(
112
+ `The number of color values for semantic color "${semanticColorName}" (${colorValues.length}) does not match the number of Tailwind color shades (${TAILWIND_COLORS_SHADES.length}).`
113
+ );
114
+ }
115
+ for (let i = 0; i < TAILWIND_COLORS_SHADES.length; i++) {
116
+ const tailwindShade = TAILWIND_COLORS_SHADES[i];
117
+ palette.addColor({
118
+ name: semanticColorName,
119
+ shade: tailwindShade,
120
+ value: colorValues[i]
121
+ });
122
+ }
123
+ }
124
+ return palette;
125
+ }
126
+
127
+ // src/options/to-color-array.ts
128
+ var PREFIX_REGEX = /^((var\()?--)?(color-)/;
129
+ var SUFFIX_REGEX = /-?\*\)?$|\)$/;
130
+ function toColorArray(variableName) {
131
+ if (!PREFIX_REGEX.test(variableName)) {
132
+ return TAILWIND_COLORS_SHADES.map(() => variableName);
133
+ }
134
+ const strippedVariableName = variableName.replace(PREFIX_REGEX, "").replace(SUFFIX_REGEX, "");
135
+ return TAILWIND_COLORS_SHADES.map((steps) => `var(--color-${strippedVariableName}-${steps})`);
136
+ }
137
+
138
+ // src/options/tailwindcss-semantic-palette-options-errors.ts
139
+ var INVALID_TAILWINDCSS_OPTIONS_TYPE = new Error("The TailwindCSS options must be an object.");
140
+ var INVALID_SEMANTIC_PALETTE_TYPE = new Error("The semantic palette option must be array of strings.");
141
+ var INVALID_CUSTOM_SEMANTIC_COLOR_TYPE = new Error(
142
+ "Each custom semantic color must be a string or an array of strings."
143
+ );
144
+ var INVALID_AMOUNT_OF_COLORS_ERROR = new Error("A semantic palette must have exactly 1 or 11 colors defined.");
145
+
146
+ // src/options/tailwindcss-semantic-palette-options.ts
147
+ var DEFAULT_SEMANTIC_PALETTE_COLOR_SHADES = toColorArray("var(--color-neutral-*)");
148
+ var DEFAULT_SEMANTIC_PALETTE = {
149
+ brand: toColorArray("var(--color-blue-*)"),
150
+ primary: toColorArray("var(--color-indigo-*)"),
151
+ secondary: toColorArray("var(--color-pink-*)"),
152
+ tertiary: toColorArray("var(--color-lime-*)"),
153
+ accent: toColorArray("var(--color-teal-*)"),
154
+ info: toColorArray("var(--color-cyan-*)"),
155
+ success: toColorArray("var(--color-green-*)"),
156
+ warning: toColorArray("var(--color-amber-*)"),
157
+ danger: toColorArray("var(--color-red-*)"),
158
+ surface: toColorArray("var(--color-gray-*)"),
159
+ container: toColorArray("var(--color-slate-*)"),
160
+ content: toColorArray("var(--color-neutral-*)")
161
+ };
162
+ var TailwindcssSemanticPaletteOptions = class {
163
+ semanticPalette;
164
+ constructor(options) {
165
+ this.semanticPalette = this.applyOptions(options);
166
+ }
167
+ applyOptions(options) {
168
+ if (options == null) {
169
+ return DEFAULT_SEMANTIC_PALETTE;
170
+ }
171
+ if (typeof options !== "object") {
172
+ throw INVALID_TAILWINDCSS_OPTIONS_TYPE;
173
+ }
174
+ return this.applyAllSemanticPaletteOptions(options);
175
+ }
176
+ applyAllSemanticPaletteOptions(options) {
177
+ let semanticPalette = {};
178
+ semanticPalette = this.applySemanticPaletteOption(options);
179
+ semanticPalette = this.applySemanticPaletteCustomColorsOption(semanticPalette, options);
180
+ return semanticPalette;
181
+ }
182
+ applySemanticPaletteOption(options) {
183
+ if (!("semantic-palette" in options)) {
184
+ return DEFAULT_SEMANTIC_PALETTE;
185
+ }
186
+ const semanticPaletteOption = options["semantic-palette"];
187
+ if (typeof semanticPaletteOption === "string") {
188
+ return this.mergeSemanticPaletteOptions([semanticPaletteOption]);
189
+ }
190
+ if (typeof semanticPaletteOption === "number") {
191
+ return this.mergeSemanticPaletteOptions([semanticPaletteOption.toString()]);
192
+ }
193
+ if (Array.isArray(semanticPaletteOption)) {
194
+ return this.mergeSemanticPaletteOptions(semanticPaletteOption);
195
+ }
196
+ throw INVALID_SEMANTIC_PALETTE_TYPE;
197
+ }
198
+ mergeSemanticPaletteOptions(semanticPaletteOption) {
199
+ const semanticPalette = {};
200
+ for (const colorName of semanticPaletteOption) {
201
+ if (colorName === "*") {
202
+ Object.assign(semanticPalette, DEFAULT_SEMANTIC_PALETTE);
203
+ } else if (colorName in DEFAULT_SEMANTIC_PALETTE) {
204
+ semanticPalette[colorName] = DEFAULT_SEMANTIC_PALETTE[colorName];
205
+ } else {
206
+ semanticPalette[colorName] = DEFAULT_SEMANTIC_PALETTE_COLOR_SHADES;
207
+ }
208
+ }
209
+ return semanticPalette;
210
+ }
211
+ applySemanticPaletteCustomColorsOption(semanticPalette, options) {
212
+ const customColorKeys = this.getAllCustomColorNames(options);
213
+ for (const customColorKey of customColorKeys) {
214
+ if (!(customColorKey in semanticPalette)) {
215
+ continue;
216
+ }
217
+ const option = this.getCustomSemanticPalette(options, customColorKey);
218
+ if (option.length === 1) {
219
+ semanticPalette[customColorKey] = toColorArray(option[0]);
220
+ } else if (option.length === 11) {
221
+ semanticPalette[customColorKey] = option;
222
+ } else {
223
+ throw INVALID_AMOUNT_OF_COLORS_ERROR;
224
+ }
225
+ }
226
+ return semanticPalette;
227
+ }
228
+ getCustomSemanticPalette(options, colorName) {
229
+ const option = options["semantic-palette--" + colorName];
230
+ if (typeof option === "string") {
231
+ return [option];
232
+ } else if (Array.isArray(option)) {
233
+ return option;
234
+ } else {
235
+ throw INVALID_CUSTOM_SEMANTIC_COLOR_TYPE;
236
+ }
237
+ }
238
+ getAllCustomColorNames(options) {
239
+ const customColorKeys = [];
240
+ for (const [potentialCustomColorKey] of Object.entries(options)) {
241
+ if (!potentialCustomColorKey.startsWith("semantic-palette--")) {
242
+ continue;
243
+ }
244
+ const customColorKey = potentialCustomColorKey.replace(/^semantic-palette--/, "");
245
+ customColorKeys.push(customColorKey);
246
+ }
247
+ return customColorKeys;
248
+ }
249
+ };
250
+
251
+ // src/tailwindcss-semantic-palette.ts
252
+ var TailwindCssSemanticPalettePlugin = class {
253
+ options;
254
+ /**
255
+ * Cached palette instance.
256
+ *
257
+ * @private
258
+ */
259
+ _palette = null;
260
+ get palette() {
261
+ if (this._palette === null) {
262
+ return generatePalette(this.options);
263
+ }
264
+ return this._palette;
265
+ }
266
+ constructor(options) {
267
+ this.options = new TailwindcssSemanticPaletteOptions(options);
268
+ }
269
+ };
270
+
271
+ // src/index.ts
272
+ var tailwindcssSemanticPalettePlugin = u.withOptions(
273
+ (options) => {
274
+ return ({ addBase }) => {
275
+ const plugin = new TailwindCssSemanticPalettePlugin(options);
276
+ addBase({
277
+ ":root": plugin.palette.cssDeclarations
278
+ });
279
+ };
280
+ },
281
+ (options) => {
282
+ const plugin = new TailwindCssSemanticPalettePlugin(options);
283
+ return {
284
+ theme: {
285
+ extend: {
286
+ colors: plugin.palette.themeExtension
287
+ }
288
+ }
289
+ };
290
+ }
291
+ );
292
+ var index_default = tailwindcssSemanticPalettePlugin;
293
+ export {
294
+ index_default as default
295
+ };
296
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../node_modules/tailwindcss/dist/plugin.mjs", "../src/palette/palette.ts", "../src/tailwindcss-color-shades.ts", "../src/palette/generate-palette.ts", "../src/options/to-color-array.ts", "../src/options/tailwindcss-semantic-palette-options-errors.ts", "../src/options/tailwindcss-semantic-palette-options.ts", "../src/tailwindcss-semantic-palette.ts", "../src/index.ts"],
4
+ "sourcesContent": ["function g(i,n){return{handler:i,config:n}}g.withOptions=function(i,n=()=>({})){function t(o){return{handler:i(o),config:n(o)}}return t.__isOptionsFunction=!0,t};var u=g;export{u as default};\n", "import { TailwindColorShade } from '@src/tailwindcss-color-shades.ts';\n\nexport interface Color {\n name: string;\n shade: TailwindColorShade;\n value: string;\n}\n\n/**\n * Holds a collection of palette and provides methods to generate\n * CSS variable declarations and Tailwind CSS theme extensions.\n */\nexport class Palette {\n /**\n * Constructs CSS variable declarations for all palette.\n *\n * Used for generating :root CSS variables in Tailwind CSS.\n *\n * Example output:\n *\n * ```typescript\n * [\"--color-primary-50: var(--color-indigo-50)\", \"--color-primary-100: var(--color-indigo-100)\", ...]\n * ```\n *\n * Example usage in CSS:\n *\n * ```typescript\n * addBase({\n * ':root': palette.cssDeclarations,\n * });\n * ```\n *\n * @return {string[]} Array of CSS variable declarations.\n */\n get cssDeclarations(): string[] {\n return this.colors.map((color) => `--color-${color.name}-${color.shade}: ${color.value};`);\n }\n\n /**\n * Constructs a nested theme object for all palette.\n *\n * Used for extending Tailwind CSS theme palette.\n *\n * Example output:\n *\n * ```typescript\n * {\n * primary: {\n * \"50\": \"var(--color-indigo-50)\",\n * \"100\": \"var(--color-indigo-100)\",\n * ...\n * },\n * secondary: {\n * \"50\": \"var(--color-pink-50)\",\n * \"100\": \"var(--color-pink-100)\",\n * ...\n * },\n * }\n * ```\n *\n * Example usage in Tailwind CSS config:\n *\n * ```typescript\n * return {\n * theme: {\n * extend: {\n * palette: palette.themeExtension,\n * },\n * },\n * };\n * ```\n *\n * @return {Record<string, Record<string, string>>} Nested theme object.\n */\n get themeExtension() {\n const theme: Record<string, Record<string, string>> = {};\n\n for (const color of this.colors) {\n if (!(color.name in theme)) {\n theme[color.name] = {};\n }\n theme[color.name]![color.shade] = color.value;\n }\n\n return theme;\n }\n\n readonly colors: Color[] = [];\n\n /**\n * Adds a new color to the collection.\n *\n * Example usage:\n *\n * ```typescript\n * palette.addColor({ name: 'primary', shade: '500', value: 'var(--color-indigo-500)' });\n * ```\n *\n * @param color {Color} The color to add.\n */\n addColor(color: Color) {\n this.colors.push(color);\n }\n}\n", "export type TailwindColorShade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;\n\nexport const TAILWIND_COLORS_SHADES: TailwindColorShade[] = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];\n", "import { TailwindcssSemanticPaletteOptions } from '../options/tailwindcss-semantic-palette-options.ts';\nimport { Palette } from '@src/palette/palette.ts';\nimport { TAILWIND_COLORS_SHADES } from '@src/tailwindcss-color-shades.ts';\n\n/**\n * Generates all palette.\n *\n * @param options a reference to the options object.\n * @returns the generated palette.\n */\nexport function generatePalette(options: TailwindcssSemanticPaletteOptions): Palette {\n const palette = new Palette();\n\n const paletteEntries = Object.entries(options.semanticPalette);\n for (const [semanticColorName, colorValues] of paletteEntries) {\n if (colorValues.length !== TAILWIND_COLORS_SHADES.length) {\n throw new Error(\n `The number of color values for semantic color \"${semanticColorName}\" (${colorValues.length}) does not match the number of Tailwind color shades (${TAILWIND_COLORS_SHADES.length}).`,\n );\n }\n\n // TAILWIND_COLORS_SHADES.length === colorValues.length\n for (let i = 0; i < TAILWIND_COLORS_SHADES.length; i++) {\n const tailwindShade = TAILWIND_COLORS_SHADES[i]!;\n palette.addColor({\n name: semanticColorName,\n shade: tailwindShade,\n value: colorValues[i]!,\n });\n }\n }\n\n return palette;\n}\n", "import { TAILWIND_COLORS_SHADES } from '@src/tailwindcss-color-shades.ts';\n\n/**\n * Matches the following prefixes:\n *\n * * \"--var(color-\"\n * * \"--color-\"\n * * \"color-\"\n */\nconst PREFIX_REGEX = /^((var\\()?--)?(color-)/;\n\n/**\n * Matches to following suffixes:\n *\n * * \")\"\n * * \"*)\"\n * * \"-*)\"\n * * \"-*\"\n */\nconst SUFFIX_REGEX = /-?\\*\\)?$|\\)$/;\n\n/**\n * Transforms a color variable from a name to an array containing all tailwind palette steps from 90 to 950.\n *\n * If a simple name is inputted this name will be wrapped into an array eleven times.\n *\n * If used with one of the following prefixes:\n *\n * * \"--var(color-\"\n * * \"--color-\"\n * * \"color-\"\n *\n * it will return an array with the desired color variable for each tailwind steps.\n *\n * The variable name may end with the following suffixes:\n *\n * * \")\"\n * * \"*)\"\n * * \"-*)\"\n * * \"-*\"\n *\n * @example The input `white` yields an array with the value `white` present eleven times.\n *\n * ```json\n * [\"white\", \"white\", \"white\", \"white\", \"white\", \"white\", \"white\", \"white\", \"white\", \"white\", \"white\"]\n * ```\n *\n * @example The input `var(--color-indigo-*) yields the following result\n *\n * ```\n * [\n * \"var(--color-indigo-50\",\n * \"var(--color-indigo-100\",\n * \"var(--color-indigo-200\",\n * \"var(--color-indigo-300\",\n * \"var(--color-indigo-400\",\n * \"var(--color-indigo-500\",\n * \"var(--color-indigo-600\",\n * \"var(--color-indigo-700\",\n * \"var(--color-indigo-800\",\n * \"var(--color-indigo-900\",\n * \"var(--color-indigo-950\"\n * ]\n * ```\n *\n * @see TAILWIND_COLORS_SHADES\n * @param variableName the name of the variable to transform into a color step array\n * @returns the color step array\n */\nexport function toColorArray(variableName: string): string[] {\n if (!PREFIX_REGEX.test(variableName)) {\n // single variable case\n // example: \"white\" -> [\"white\", \"white\", ..., \"white\"]\n return TAILWIND_COLORS_SHADES.map(() => variableName);\n }\n\n // multi variable case\n // example: \"var(--color-indigo-*)\" -> [\"var(--color-indigo-50)\", \"var(--color-indigo-100)\", ..., \"var(--color-indigo-950)\"]\n\n // Strip the prefix and suffix from the variable name and leave only the variable name\n const strippedVariableName = variableName.replace(PREFIX_REGEX, '').replace(SUFFIX_REGEX, '');\n return TAILWIND_COLORS_SHADES.map((steps) => `var(--color-${strippedVariableName}-${steps})`);\n}\n", "export const INVALID_TAILWINDCSS_OPTIONS_TYPE = new Error('The TailwindCSS options must be an object.');\nexport const INVALID_SEMANTIC_PALETTE_TYPE = new Error('The semantic palette option must be array of strings.');\nexport const INVALID_CUSTOM_SEMANTIC_COLOR_TYPE = new Error(\n 'Each custom semantic color must be a string or an array of strings.',\n);\nexport const INVALID_AMOUNT_OF_COLORS_ERROR = new Error('A semantic palette must have exactly 1 or 11 colors defined.');\n", "/**\n * @packageDocumentation\n *\n * This package is responsible for parsing the options object provided from TailwindCSS into a typed class that is\n * getting used for generating the palette.\n *\n * This package does the following things:\n *\n * ## No options provided\n *\n * If the user didn't provide any options, a default should be chosen containing a handful of useful color additions for\n * the palette. The user can simply go with the default palette by importing the plugin with no options provided like\n * the following:\n *\n * ```css\n * @import 'tailwindcss';\n * @plugin '@IlijazM/tailwindcss-semantic-palette';\n * ```\n *\n * This yields the default output which is defined in the const {@link DEFAULT_SEMANTIC_PALETTE} and looks like the\n * following:\n *\n * ```json\n * {\n * \"semanticPalette\": {\n * \"brand\": [\"var(--color-blue-50)\", \"var(--color-blue-100)\", ..., \"var(--color-blue-950)\"],\n * \"primary\": [\"var(--color-indigo-50)\", \"var(--color-indigo-100)\", ..., \"var(--color-indigo-950)\"],\n * ...\n * \"content\": [\"var(--color-neutral-50)\", \"var(--color-neutral-100)\", ..., \"var(--color-neutral-950)\"],\n * }\n * }\n * ```\n *\n * ## A sub-set of colors\n *\n * A user may select a sub-set of colors that get used. This is useful if said user only needs for example \"primary\" and\n * \"brand\". The user can select these two colors by prompting the sub-set of colors using the option \"semantic-palette\"\n * which looks like the following:\n *\n * ```css\n * @import 'tailwindcss';\n * @plugin '@IlijazM/tailwindcss-semantic-palette' {\n * semantic-palette: primary, brand;\n * }\n * ```\n *\n * This yields a subset of the default output defined in the const {@link DEFAULT_SEMANTIC_PALETTE} and looks like the\n * following:\n *\n * ```json\n * {\n * \"semanticPalette\": {\n * \"brand\": [\"var(--color-blue-50)\", \"var(--color-blue-100)\", ..., \"var(--color-blue-950)\"],\n * \"primary\": [\"var(--color-indigo-50)\", \"var(--color-indigo-100)\", ..., \"var(--color-indigo-950)\"],\n * }\n * }\n * ```\n *\n * ## Custom colors\n *\n * A user may define his custom colors. This is useful if there is a specific use case where a color should get assigned\n * a semantic meaning for example the user defined an ui that includes a kanban board. That kanban board should use a\n * semantic color for each column which includes \"To Do\", \"In Progress\", \"Done\". It needs these colors in different\n * shades because the background color, border color, text color, and button color changes based on the column. In this\n * case the user can define new colors by using the options \"semantic-palette\" and the options\n * \"semantic-palette--<color_name>\" which looks the following:\n *\n * ```css\n * @import 'tailwindcss';\n * @plugin '@IlijazM/tailwindcss-semantic-palette' {\n * semantic-palette: \"*\", to-do, in-progress, done;\n * semantic-palette--to-do: \"#ecfbf3\", \"#c6f2da\", \"#a0eac1\", \"#7be1a9\", \"#55d990\", \"#2fd077\", \"#26aa62\", \"#1e844c\", \"#155f36\", \"#0d3921\", \"#04130b\";\n * semantic-palette--in-progress: \"var(--color-sky-50)\", \"var(--color-sky-100)\", \"var(--color-sky-200)\", \"var(--color-sky-300)\", \"var(--color-sky-400)\", \"var(--color-sky-500)\", \"var(--color-sky-600)\", \"var(--color-sky-700)\", \"var(--color-sky-800)\", \"var(--color-sky-900)\", \"var(--color-sky-950)\";\n * 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%)\"\n * }\n * ```\n *\n * ## Customize colors\n *\n * A user may select, add, and customize colors\n *\n */\n\nimport { toColorArray } from '@src/options/to-color-array.ts';\nimport {\n INVALID_AMOUNT_OF_COLORS_ERROR,\n INVALID_CUSTOM_SEMANTIC_COLOR_TYPE,\n INVALID_SEMANTIC_PALETTE_TYPE,\n INVALID_TAILWINDCSS_OPTIONS_TYPE,\n} from '@src/options/tailwindcss-semantic-palette-options-errors.ts';\n\ntype PaletteOptionsType = Record<string, string[]>;\n\nexport interface TailwindCssSemanticPaletteThemedOptionsType {\n semanticPalette: PaletteOptionsType;\n}\n\nexport const DEFAULT_SEMANTIC_PALETTE_COLOR_SHADES = toColorArray('var(--color-neutral-*)');\n\nexport const DEFAULT_SEMANTIC_PALETTE: Record<string, string[]> = {\n brand: toColorArray('var(--color-blue-*)'),\n primary: toColorArray('var(--color-indigo-*)'),\n secondary: toColorArray('var(--color-pink-*)'),\n tertiary: toColorArray('var(--color-lime-*)'),\n accent: toColorArray('var(--color-teal-*)'),\n info: toColorArray('var(--color-cyan-*)'),\n success: toColorArray('var(--color-green-*)'),\n warning: toColorArray('var(--color-amber-*)'),\n danger: toColorArray('var(--color-red-*)'),\n surface: toColorArray('var(--color-gray-*)'),\n container: toColorArray('var(--color-slate-*)'),\n content: toColorArray('var(--color-neutral-*)'),\n};\n\nexport class TailwindcssSemanticPaletteOptions implements TailwindCssSemanticPaletteThemedOptionsType {\n readonly semanticPalette: PaletteOptionsType;\n\n constructor(options: unknown) {\n this.semanticPalette = this.applyOptions(options);\n }\n\n private applyOptions(options: unknown): PaletteOptionsType {\n if (options == null) {\n return DEFAULT_SEMANTIC_PALETTE;\n }\n\n if (typeof options !== 'object') {\n throw INVALID_TAILWINDCSS_OPTIONS_TYPE;\n }\n\n return this.applyAllSemanticPaletteOptions(options);\n }\n\n private applyAllSemanticPaletteOptions(options: any): PaletteOptionsType {\n let semanticPalette: PaletteOptionsType = {};\n\n semanticPalette = this.applySemanticPaletteOption(options);\n semanticPalette = this.applySemanticPaletteCustomColorsOption(semanticPalette, options);\n\n return semanticPalette;\n }\n\n private applySemanticPaletteOption(options: any): PaletteOptionsType {\n // If no semantic palette option is provided, return the default semantic palette.\n if (!('semantic-palette' in options)) {\n return DEFAULT_SEMANTIC_PALETTE;\n }\n\n const semanticPaletteOption = options['semantic-palette'];\n\n // This case happens when there is only on color provided in the .css file. In this case the string should just be\n // treated as an array with one element.\n //\n // For example:\n //\n // ```css\n // @import 'tailwindcss';\n // @plugin '@IlijazM/tailwindcss-semantic-palette' {\n // semantic-palette: primary;\n // }\n // ```\n if (typeof semanticPaletteOption === 'string') {\n return this.mergeSemanticPaletteOptions([semanticPaletteOption]);\n }\n\n // This is a special case where the user provides a number instead of a string. This can happen when the user\n // provides a number color name without quotes in the .css file. I'm not sure why someone would do that, but just in\n // case. In this case the number should be treated as an array with the number as string as the only element.\n //\n // For example:\n //\n // ```css\n // @import 'tailwindcss';\n // @plugin '@IlijazM/tailwindcss-semantic-palette' {\n // semantic-palette: 100;\n // }\n // ```\n if (typeof semanticPaletteOption === 'number') {\n return this.mergeSemanticPaletteOptions([semanticPaletteOption.toString()]);\n }\n\n // This case happens when there is a list of colors provided in the .css file.\n //\n // For example:\n //\n // ```css\n // @import 'tailwindcss';\n // @plugin '@IlijazM/tailwindcss-semantic-palette' {\n // semantic-palette: primary, brand;\n // }\n // ```\n if (Array.isArray(semanticPaletteOption)) {\n return this.mergeSemanticPaletteOptions(semanticPaletteOption);\n }\n\n // If the semantic palette option is not a string, number, or array, throw an error. I'm not sure how this would\n // happen, but just in case.\n throw INVALID_SEMANTIC_PALETTE_TYPE;\n }\n\n private mergeSemanticPaletteOptions(semanticPaletteOption: string[]): PaletteOptionsType {\n const semanticPalette: PaletteOptionsType = {};\n\n for (const colorName of semanticPaletteOption) {\n if (colorName === '*') {\n Object.assign(semanticPalette, DEFAULT_SEMANTIC_PALETTE);\n } else if (colorName in DEFAULT_SEMANTIC_PALETTE) {\n semanticPalette[colorName] = DEFAULT_SEMANTIC_PALETTE[colorName]!;\n } else {\n semanticPalette[colorName] = DEFAULT_SEMANTIC_PALETTE_COLOR_SHADES;\n }\n }\n\n return semanticPalette;\n }\n\n private applySemanticPaletteCustomColorsOption(\n semanticPalette: PaletteOptionsType,\n options: any,\n ): PaletteOptionsType {\n const customColorKeys: string[] = this.getAllCustomColorNames(options);\n\n for (const customColorKey of customColorKeys) {\n if (!(customColorKey in semanticPalette)) {\n // Potentially warn the user that they defined a custom color that is not in the semantic palette.\n continue;\n }\n\n const option = this.getCustomSemanticPalette(options, customColorKey);\n\n if (option.length === 1) {\n semanticPalette[customColorKey] = toColorArray(option[0]!);\n } else if (option.length === 11) {\n semanticPalette[customColorKey] = option;\n } else {\n throw INVALID_AMOUNT_OF_COLORS_ERROR;\n }\n }\n\n return semanticPalette;\n }\n\n private getCustomSemanticPalette(options: any, colorName: string): string[] {\n const option = options['semantic-palette--' + colorName];\n\n if (typeof option === 'string') {\n return [option];\n } else if (Array.isArray(option)) {\n return option;\n } else {\n throw INVALID_CUSTOM_SEMANTIC_COLOR_TYPE;\n }\n }\n\n private getAllCustomColorNames(options: any): string[] {\n const customColorKeys: string[] = [];\n\n for (const [potentialCustomColorKey] of Object.entries(options)) {\n if (!potentialCustomColorKey.startsWith('semantic-palette--')) {\n continue;\n }\n\n const customColorKey = potentialCustomColorKey.replace(/^semantic-palette--/, '');\n customColorKeys.push(customColorKey);\n }\n\n return customColorKeys;\n }\n}\n", "import { generatePalette } from '@src/palette/generate-palette.ts';\nimport { TailwindcssSemanticPaletteOptions } from './options/tailwindcss-semantic-palette-options.ts';\nimport { Palette } from '@src/palette/palette.js';\n\nexport class TailwindCssSemanticPalettePlugin {\n private readonly options: TailwindcssSemanticPaletteOptions;\n\n /**\n * Cached palette instance.\n *\n * @private\n */\n private _palette: Palette | null = null;\n\n public get palette() {\n if (this._palette === null) {\n return generatePalette(this.options);\n }\n return this._palette!;\n }\n\n constructor(options: unknown) {\n this.options = new TailwindcssSemanticPaletteOptions(options);\n }\n}\n", "import plugin from 'tailwindcss/plugin';\nimport type { PluginCreator } from 'tailwindcss/plugin';\n\nimport { TailwindCssSemanticPalettePlugin } from '@src/tailwindcss-semantic-palette.ts';\n\nconst tailwindcssSemanticPalettePlugin: PluginCreator = plugin.withOptions(\n (options) => {\n return ({ addBase }) => {\n const plugin = new TailwindCssSemanticPalettePlugin(options);\n\n addBase({\n ':root': plugin.palette.cssDeclarations,\n });\n };\n },\n\n (options) => {\n const plugin = new TailwindCssSemanticPalettePlugin(options);\n\n return {\n theme: {\n extend: {\n colors: plugin.palette.themeExtension,\n },\n },\n };\n },\n);\n\nexport default tailwindcssSemanticPalettePlugin;\n"],
5
+ "mappings": ";AAAA,SAAS,EAAE,GAAE,GAAE;AAAC,SAAM,EAAC,SAAQ,GAAE,QAAO,EAAC;AAAC;AAAC,EAAE,cAAY,SAAS,GAAE,IAAE,OAAK,CAAC,IAAG;AAAC,WAAS,EAAE,GAAE;AAAC,WAAM,EAAC,SAAQ,EAAE,CAAC,GAAE,QAAO,EAAE,CAAC,EAAC;AAAA,EAAC;AAAC,SAAO,EAAE,sBAAoB,MAAG;AAAC;AAAE,IAAI,IAAE;;;ACYjK,IAAM,UAAN,MAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBnB,IAAI,kBAA4B;AAC9B,WAAO,KAAK,OAAO,IAAI,CAAC,UAAU,WAAW,MAAM,IAAI,IAAI,MAAM,KAAK,KAAK,MAAM,KAAK,GAAG;AAAA,EAC3F;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsCA,IAAI,iBAAiB;AACnB,UAAM,QAAgD,CAA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/tailwindcss-semantic-palette",
3
+ "version": "0.1.1",
4
+ "description": "TailwindCSS Semantic Palette is a highly extendable plugin for Tailwind CSS that extends the default color palette with colors with semantic meaning.",
5
+ "scripts": {
6
+ "typecheck": "tsc --noEmit",
7
+ "lint": "eslint",
8
+ "test": "jest",
9
+ "build": "node --experimental-transform-types build.ts",
10
+ "dev": "npm run build -- --watch"
11
+ },
12
+ "main": "dist/index.js",
13
+ "type": "module",
14
+ "files": [
15
+ "dist/",
16
+ "docs/",
17
+ "README.md"
18
+ ],
19
+ "keywords": [
20
+ "tailwind",
21
+ "tailwindcss",
22
+ "plugin",
23
+ "css",
24
+ "utilities",
25
+ "components",
26
+ "colors",
27
+ "palette"
28
+ ],
29
+ "exports": {
30
+ ".": {
31
+ "import": "./dist/index.js",
32
+ "require": "./dist/index.js",
33
+ "default": "./dist/index.js"
34
+ }
35
+ },
36
+ "author": "Ilijaz Mehmedovic",
37
+ "license": "MIT",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+git@github.com:IlijazM/tailwindcss-semantic-utilities.git",
41
+ "directory": "tailwindcss-semantic-palette"
42
+ },
43
+ "dependencies": {
44
+ "tailwindcss": "^4.1.11"
45
+ },
46
+ "devDependencies": {
47
+ "@types/jest": "^30.0.0",
48
+ "@types/node": "^24.0.13",
49
+ "@typescript-eslint/eslint-plugin": "^8.36.0",
50
+ "@typescript-eslint/parser": "^8.36.0",
51
+ "esbuild": "^0.25.6",
52
+ "eslint": "^9.31.0",
53
+ "jest": "^30.0.4",
54
+ "ts-jest": "^29.4.0",
55
+ "typescript-eslint": "^8.36.0"
56
+ }
57
+ }