tailwindcss-custom-colors 1.0.0

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.
@@ -0,0 +1,25 @@
1
+ interface Options {
2
+ suffixMultiplier: number;
3
+ }
4
+ interface TailwindColorsConfig {
5
+ [key: string]: Record<string, string>;
6
+ }
7
+ /**
8
+ * Generate a config colors object for tailwindcss
9
+ * @param {string[] | string} colorNames - An array of color names or a single color name
10
+ * @param {Options} [options] - An object of options (optional)
11
+ * @returns {TailwindColorsConfig} A config object for tailwindcss
12
+ */
13
+ declare const generateConfig: (colorNames: string[] | string, options?: Options) => TailwindColorsConfig;
14
+ interface ColorParams {
15
+ color: string;
16
+ name: string;
17
+ }
18
+ /**
19
+ * Generate reactive styles
20
+ * @param {ColorParams[] | ColorParams} colorParams - An array of color params or a single color params
21
+ * @param {Options} [options] - An object of options (optional)
22
+ * @returns {string} A string of css variables
23
+ */
24
+ declare const generateReactiveStyles: (colorParams: ColorParams[] | ColorParams, options?: Options) => string;
25
+ export { generateConfig, generateReactiveStyles };
package/dist/index.js ADDED
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateReactiveStyles = exports.generateConfig = void 0;
7
+ const chroma_1 = require("./utils/chroma");
8
+ const hexToRgb_1 = require("./utils/hexToRgb");
9
+ const hexToHsl_1 = __importDefault(require("./utils/hexToHsl"));
10
+ const round_1 = __importDefault(require("./utils/round"));
11
+ const shades = [1, 2, 3, 4, 5, 6, 7, 8, 9];
12
+ const defaultOptions = {
13
+ suffixMultiplier: 100, // or 1
14
+ };
15
+ /**
16
+ * Generate a config colors object for tailwindcss
17
+ * @param {string[] | string} colorNames - An array of color names or a single color name
18
+ * @param {Options} [options] - An object of options (optional)
19
+ * @returns {TailwindColorsConfig} A config object for tailwindcss
20
+ */
21
+ const generateConfig = (colorNames, options) => {
22
+ const selectedOptions = { ...defaultOptions, ...(options || {}) };
23
+ const colors = Array.isArray(colorNames) ? colorNames : [colorNames];
24
+ const config = {};
25
+ colors.forEach((color) => {
26
+ const colorTints = {
27
+ DEFAULT: `rgb(var(${color}) / <alpha-value>)`,
28
+ };
29
+ shades.forEach((shade) => {
30
+ const tintSuffix = `${shade * selectedOptions.suffixMultiplier}`;
31
+ colorTints[tintSuffix] = `rgb(var(${color}-${tintSuffix}) / <alpha-value>)`;
32
+ });
33
+ config[color] = colorTints;
34
+ });
35
+ return config;
36
+ };
37
+ exports.generateConfig = generateConfig;
38
+ /**
39
+ * Generate reactive styles
40
+ * @param {ColorParams[] | ColorParams} colorParams - An array of color params or a single color params
41
+ * @param {Options} [options] - An object of options (optional)
42
+ * @returns {string} A string of css variables
43
+ */
44
+ const generateReactiveStyles = (colorParams, options) => {
45
+ const selectedOptions = { ...defaultOptions, ...(options || {}) };
46
+ const colors = Array.isArray(colorParams) ? colorParams : [colorParams];
47
+ const styles = colors.map(({ color, name }) => {
48
+ const hslColor = (0, hexToHsl_1.default)(color);
49
+ const tintsString = [`${name}: ${(0, hexToRgb_1.hexToRgbString)(color)}`];
50
+ shades.forEach((shade) => {
51
+ const tintSuffix = `${shade * selectedOptions.suffixMultiplier}`;
52
+ if (shade === 5) {
53
+ tintsString.push(`${name}-${tintSuffix}: ${(0, hexToRgb_1.hexToRgbString)(color)}`);
54
+ }
55
+ else if (shade < 5) {
56
+ let ratio = (0, round_1.default)(-0.2 * shade + 1);
57
+ tintsString.push(`${name}-${tintSuffix}: ${(0, chroma_1.lighten)(hslColor, ratio)}`);
58
+ }
59
+ else {
60
+ let ratio = (0, round_1.default)(0.2 * shade - 1.0);
61
+ tintsString.push(`${name}-${tintSuffix}: ${(0, chroma_1.darken)(hslColor, ratio)}`);
62
+ }
63
+ });
64
+ return tintsString.join(";\n");
65
+ });
66
+ return styles.join(";\n");
67
+ };
68
+ exports.generateReactiveStyles = generateReactiveStyles;
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAiD;AACjD,+CAAkD;AAClD,gEAAwC;AACxC,0DAAkC;AAElC,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE3C,MAAM,cAAc,GAAG;IACrB,gBAAgB,EAAE,GAAG,EAAE,OAAO;CAC/B,CAAC;AAUF;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CACrB,UAA6B,EAC7B,OAAiB,EACK,EAAE;IACxB,MAAM,eAAe,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;IAElE,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAErE,MAAM,MAAM,GAAyB,EAAE,CAAC;IAExC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACvB,MAAM,UAAU,GAA2B;YACzC,OAAO,EAAE,WAAW,KAAK,oBAAoB;SAC9C,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,MAAM,UAAU,GAAG,GAAG,KAAK,GAAG,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACjE,UAAU,CACR,UAAU,CACX,GAAG,WAAW,KAAK,IAAI,UAAU,oBAAoB,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAyCO,wCAAc;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IAAI,IAAI,UAAU,KAAK,IAAA,eAAM,EAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;aACvE;QACH,CAAC,CAAC,CAAC;QACH,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEuB,wDAAsB"}
@@ -0,0 +1,2 @@
1
+ export declare function darken(hsl: [number, number, number], val: number): `${number} ${number} ${number}`;
2
+ export declare function lighten(hsl: [number, number, number], val: number): `${number} ${number} ${number}`;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.lighten = exports.darken = void 0;
7
+ const hexToRgb_1 = require("./hexToRgb");
8
+ const hslToRgb_1 = __importDefault(require("./hslToRgb"));
9
+ function darkenHsl(hsl, val) {
10
+ hsl[2] -= hsl[2] * val;
11
+ return hsl;
12
+ }
13
+ function lightenHsl(hsl, val) {
14
+ hsl[2] += hsl[2] * val;
15
+ return hsl;
16
+ }
17
+ function darken(hsl, val) {
18
+ return (0, hexToRgb_1.rgbToString)((0, hslToRgb_1.default)(darkenHsl(hsl, val)));
19
+ }
20
+ exports.darken = darken;
21
+ function lighten(hsl, val) {
22
+ return (0, hexToRgb_1.rgbToString)((0, hslToRgb_1.default)(lightenHsl(hsl, val)));
23
+ }
24
+ exports.lighten = lighten;
25
+ //# sourceMappingURL=chroma.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chroma.js","sourceRoot":"","sources":["../../src/utils/chroma.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAyC;AACzC,0DAAkC;AAElC,SAAS,SAAS,CAAC,GAA6B,EAAE,GAAW;IAC3D,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IAEvB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,UAAU,CAAC,GAA6B,EAAE,GAAW;IAC5D,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IAEvB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,MAAM,CAAC,GAA6B,EAAE,GAAW;IAC/D,OAAO,IAAA,sBAAW,EAAC,IAAA,kBAAQ,EAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,wBAEC;AAED,SAAgB,OAAO,CAAC,GAA6B,EAAE,GAAW;IAChE,OAAO,IAAA,sBAAW,EAAC,IAAA,kBAAQ,EAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,0BAEC"}
@@ -0,0 +1 @@
1
+ export default function hexToHsl(hex: string): [number, number, number];
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const hexToRgb_1 = __importDefault(require("./hexToRgb"));
7
+ const rgbToHsl_1 = __importDefault(require("./rgbToHsl"));
8
+ function hexToHsl(hex) {
9
+ return (0, rgbToHsl_1.default)((0, hexToRgb_1.default)(hex));
10
+ }
11
+ exports.default = hexToHsl;
12
+ //# sourceMappingURL=hexToHsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hexToHsl.js","sourceRoot":"","sources":["../../src/utils/hexToHsl.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,0DAAkC;AAElC,SAAwB,QAAQ,CAAC,GAAW;IAC1C,OAAO,IAAA,kBAAQ,EAAC,IAAA,kBAAQ,EAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC;AAFD,2BAEC"}
@@ -0,0 +1,7 @@
1
+ export default function hexToRgb(hex: string): [number, number, number];
2
+ export declare function rgbToString([r, g, b]: [
3
+ number,
4
+ number,
5
+ number
6
+ ]): `${number} ${number} ${number}`;
7
+ export declare function hexToRgbString(hex: string): `${number} ${number} ${number}`;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hexToRgbString = exports.rgbToString = void 0;
4
+ function hexToRgb(hex) {
5
+ const hexString = hex.replace("#", "");
6
+ const validHexRegExp = /^[0-9A-Fa-f]{6}$/;
7
+ if (!validHexRegExp.test(hexString)) {
8
+ throw new Error(`Invalid hexadecimal color code: ${hex}`);
9
+ }
10
+ const r = parseInt(hexString.substring(0, 2), 16);
11
+ const g = parseInt(hexString.substring(2, 4), 16);
12
+ const b = parseInt(hexString.substring(4, 6), 16);
13
+ return [r, g, b];
14
+ }
15
+ exports.default = hexToRgb;
16
+ function rgbToString([r, g, b]) {
17
+ return `${r} ${g} ${b}`;
18
+ }
19
+ exports.rgbToString = rgbToString;
20
+ function hexToRgbString(hex) {
21
+ return rgbToString(hexToRgb(hex));
22
+ }
23
+ exports.hexToRgbString = hexToRgbString;
24
+ //# sourceMappingURL=hexToRgb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hexToRgb.js","sourceRoot":"","sources":["../../src/utils/hexToRgb.ts"],"names":[],"mappings":";;;AAAA,SAAwB,QAAQ,CAAC,GAAW;IAC1C,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAEvC,MAAM,cAAc,GAAG,kBAAkB,CAAC;IAC1C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAC;KAC3D;IAED,MAAM,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClD,MAAM,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClD,MAAM,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClD,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACnB,CAAC;AAZD,2BAYC;AAED,SAAgB,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAInC;IACC,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1B,CAAC;AAND,kCAMC;AAED,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAFD,wCAEC"}
@@ -0,0 +1,5 @@
1
+ export default function hslToRgb([h, s, l]: [number, number, number]): [
2
+ number,
3
+ number,
4
+ number
5
+ ];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function hslToRgb([h, s, l]) {
4
+ const k = (n) => (n + h / 30) % 12;
5
+ const a = s * Math.min(l, 1 - l);
6
+ const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
7
+ return [
8
+ Math.round(255 * f(0)),
9
+ Math.round(255 * f(8)),
10
+ Math.round(255 * f(4)),
11
+ ];
12
+ }
13
+ exports.default = hslToRgb;
14
+ //# sourceMappingURL=hslToRgb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hslToRgb.js","sourceRoot":"","sources":["../../src/utils/hslToRgb.ts"],"names":[],"mappings":";;AAAA,SAAwB,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAA2B;IAKlE,MAAM,CAAC,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;IAC3C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,MAAM,CAAC,GAAG,CAAC,CAAS,EAAE,EAAE,CACtB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,OAAO;QACL,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACvB,CAAC;AACJ,CAAC;AAdD,2BAcC"}
@@ -0,0 +1,5 @@
1
+ export default function rgbToHsl([r, g, b]: [number, number, number]): [
2
+ number,
3
+ number,
4
+ number
5
+ ];
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function rgbToHsl([r, g, b]) {
4
+ // Normalize RGB values to the range [0, 1]
5
+ const normalizedR = r / 255;
6
+ const normalizedG = g / 255;
7
+ const normalizedB = b / 255;
8
+ // Find the min and max values among R, G, and B
9
+ const min = Math.min(normalizedR, normalizedG, normalizedB);
10
+ const max = Math.max(normalizedR, normalizedG, normalizedB);
11
+ const delta = max - min;
12
+ // Calculate the hue (H)
13
+ let h = 0;
14
+ if (delta === 0) {
15
+ h = 0; // No chroma, hue is undefined or arbitrary (here set to 0)
16
+ }
17
+ else if (max === normalizedR) {
18
+ h = ((normalizedG - normalizedB) / delta) % 6;
19
+ }
20
+ else if (max === normalizedG) {
21
+ h = (normalizedB - normalizedR) / delta + 2;
22
+ }
23
+ else {
24
+ h = (normalizedR - normalizedG) / delta + 4;
25
+ }
26
+ h = Math.round(h * 60); // Convert hue to degrees
27
+ if (h < 0) {
28
+ h += 360; // Ensure hue is a positive angle
29
+ }
30
+ // Calculate the lightness (L)
31
+ const l = (max + min) / 2;
32
+ // Calculate the saturation (S)
33
+ let s = 0;
34
+ if (delta !== 0) {
35
+ s = delta / (1 - Math.abs(2 * l - 1));
36
+ }
37
+ // Round saturation and lightness to two decimal places
38
+ s = Math.round(s * 100) / 100;
39
+ const roundedL = Math.round(l * 100) / 100;
40
+ return [h, s, roundedL];
41
+ }
42
+ exports.default = rgbToHsl;
43
+ //# sourceMappingURL=rgbToHsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rgbToHsl.js","sourceRoot":"","sources":["../../src/utils/rgbToHsl.ts"],"names":[],"mappings":";;AAAA,SAAwB,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAA2B;IAKlE,2CAA2C;IAC3C,MAAM,WAAW,GAAG,CAAC,GAAG,GAAG,CAAC;IAC5B,MAAM,WAAW,GAAG,CAAC,GAAG,GAAG,CAAC;IAC5B,MAAM,WAAW,GAAG,CAAC,GAAG,GAAG,CAAC;IAE5B,gDAAgD;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC;IAExB,wBAAwB;IACxB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,KAAK,KAAK,CAAC,EAA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defineProperty(exports, "__esModule", { value: true });
3
+ function round(val) {
4
+ return Math.round((val + Number.EPSILON) * 100) / 100;
5
+ }
6
+ exports.default = round;
7
+ //# sourceMappingURL=round.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"round.js","sourceRoot":"","sources":["../../src/utils/round.ts"],"names":[],"mappings":";;AAAA,SAAwB,KAAK,CAAC,GAAW;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACxD,CAAC;AAFD,wBAEC"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "tailwindcss-custom-colors",
3
+ "version": "1.0.0",
4
+ "description": "Reactive color shades generator for TailwindCSS",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist/**/*"
8
+ ],
9
+ "scripts": {
10
+ "test": "jest",
11
+ "build": "tsc"
12
+ },
13
+ "keywords": [
14
+ "tailwind",
15
+ "tailwindcss",
16
+ "colors",
17
+ "palette",
18
+ "shades",
19
+ "tints"
20
+ ],
21
+ "author": "quentinjuarez",
22
+ "license": "MIT",
23
+ "devDependencies": {
24
+ "@types/jest": "^29.5.3",
25
+ "@types/node": "^20.4.4",
26
+ "jest": "^29.6.1",
27
+ "ts-jest": "^29.1.1",
28
+ "typescript": "^5.1.6"
29
+ }
30
+ }