colbrush 1.0.0 → 1.0.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.
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.node.ts
31
+ var index_node_exports = {};
32
+ __export(index_node_exports, {
33
+ applyThemes: () => applyThemes
34
+ });
35
+ module.exports = __toCommonJS(index_node_exports);
36
+
37
+ // src/node/applyThemes.ts
38
+ var import_node_fs = __toESM(require("fs"), 1);
39
+ var import_postcss = __toESM(require("postcss"), 1);
40
+ var import_postcss_safe_parser = __toESM(require("postcss-safe-parser"), 1);
41
+
42
+ // src/utils/core/colorScale.ts
43
+ var import_colorjs = __toESM(require("colorjs.io"), 1);
44
+
45
+ // src/constants/variation.ts
46
+ var DEFAULT_KEYS = [
47
+ "50",
48
+ "100",
49
+ "200",
50
+ "300",
51
+ "400",
52
+ "500",
53
+ "600",
54
+ "700",
55
+ "800",
56
+ "900"
57
+ ];
58
+ var DEFAULT_SCALE = {
59
+ "50": { dL: 0.36, cMul: 0.95 },
60
+ "100": { dL: 0.28, cMul: 0.96 },
61
+ "200": { dL: 0.18, cMul: 0.98 },
62
+ "300": { dL: 0.08, cMul: 0.99 },
63
+ "400": { dL: 0.02, cMul: 1 },
64
+ "500": { dL: 0, cMul: 1 },
65
+ "600": { dL: -0.05, cMul: 0.98 },
66
+ "700": { dL: -0.15, cMul: 0.94 },
67
+ "800": { dL: -0.22, cMul: 0.9 },
68
+ "900": { dL: -0.3, cMul: 0.88 }
69
+ };
70
+
71
+ // src/utils/core/colorScale.ts
72
+ var CLAMP01 = (x) => Math.max(0, Math.min(1, x));
73
+ function hexToOKLCH(hex) {
74
+ const c = new import_colorjs.default(hex);
75
+ const o = c.to("oklch");
76
+ return { l: o.l, c: o.c, h: o.h ?? 0 };
77
+ }
78
+ function oklchToHex(l, c, h) {
79
+ const color = new import_colorjs.default("oklch", [l, c, h]);
80
+ const srgb = color.to("srgb");
81
+ const r = CLAMP01(srgb.r), g = CLAMP01(srgb.g), b = CLAMP01(srgb.b);
82
+ return new import_colorjs.default("srgb", [r, g, b]).toString({ format: "hex" });
83
+ }
84
+ function buildScaleFromBaseHex(baseHex, opts) {
85
+ const keys = opts?.keys ?? DEFAULT_KEYS;
86
+ const cMin = opts?.cMin ?? 0.02;
87
+ const cMax = opts?.cMax ?? 0.4;
88
+ const lockHue = true;
89
+ const base = hexToOKLCH(baseHex);
90
+ const out = {};
91
+ for (const k of keys) {
92
+ const pat = DEFAULT_SCALE[k] ?? DEFAULT_SCALE["500"];
93
+ const L = CLAMP01(base.l + pat.dL);
94
+ const C = Math.max(cMin, Math.min(cMax, base.c * pat.cMul));
95
+ const H = lockHue ? base.h : base.h;
96
+ out[k] = oklchToHex(L, C, H);
97
+ }
98
+ return out;
99
+ }
100
+
101
+ // src/constants/regex.ts
102
+ var variationRegex = /^--(.+?)-(50|100|200|300|400|500|600|700|800|900)$/i;
103
+
104
+ // src/node/applyThemes.ts
105
+ var CSS_PATH = "src/index.css";
106
+ function toThemeColor(hex, _vision) {
107
+ return hex;
108
+ }
109
+ function loadRoot(cssPath = CSS_PATH) {
110
+ const css = import_node_fs.default.readFileSync(cssPath, "utf8");
111
+ return (0, import_postcss.default)().process(css, { parser: import_postcss_safe_parser.default }).root;
112
+ }
113
+ function getExistingKeysForToken(root, token) {
114
+ const keys = /* @__PURE__ */ new Set();
115
+ root.walkDecls((d) => {
116
+ if (!d.prop.startsWith("--")) return;
117
+ const m = d.prop.match(variationRegex);
118
+ if (!m) return;
119
+ const [, t, k] = m;
120
+ if (t === token) keys.add(k);
121
+ });
122
+ return Array.from(keys);
123
+ }
124
+ function upsertBlock(root, selector, kv) {
125
+ let rule;
126
+ root.walkRules((r) => {
127
+ if (r.selector === selector) rule = r;
128
+ });
129
+ if (!rule) {
130
+ rule = new import_postcss.Rule({ selector });
131
+ root.append(rule);
132
+ }
133
+ const remain = new Map(Object.entries(kv));
134
+ rule.walkDecls((d) => {
135
+ if (remain.has(d.prop)) {
136
+ d.value = remain.get(d.prop);
137
+ remain.delete(d.prop);
138
+ }
139
+ });
140
+ for (const [prop, value] of remain) rule.append({ prop, value });
141
+ }
142
+ function getColorVariablesFromRoot(root) {
143
+ const vars = {};
144
+ root.walkDecls((decl) => {
145
+ const name = decl.prop.trim();
146
+ const value = decl.value.trim();
147
+ if (name.startsWith("--color")) {
148
+ vars[name] = value;
149
+ }
150
+ });
151
+ return vars;
152
+ }
153
+ function applyThemes(input, cssPath = CSS_PATH) {
154
+ const root = loadRoot(cssPath);
155
+ const originalVars = getColorVariablesFromRoot(root);
156
+ const varsForTheme = {};
157
+ for (const [varName, value] of Object.entries(originalVars)) {
158
+ varsForTheme[varName] = value;
159
+ }
160
+ for (const [varName, val] of Object.entries(input.variables)) {
161
+ const rich = typeof val === "string" ? inferRich(varName, val) : val;
162
+ const m = varName.match(variationRegex);
163
+ const isPattern = !!m;
164
+ if (isPattern) {
165
+ const [, token] = m;
166
+ const keys = rich.keys && rich.keys.length ? rich.keys : getExistingKeysForToken(root, token).length ? getExistingKeysForToken(root, token) : Array.from(DEFAULT_KEYS);
167
+ if (rich.scale !== false) {
168
+ const scaleMap = buildScaleFromBaseHex(rich.base, { keys });
169
+ for (const k of keys) {
170
+ const hex = scaleMap[k];
171
+ varsForTheme[`--${token}-${k}`] = toThemeColor(hex, input.vision);
172
+ }
173
+ } else {
174
+ varsForTheme[varName] = toThemeColor(rich.base, input.vision);
175
+ }
176
+ } else {
177
+ varsForTheme[varName] = toThemeColor(rich.base, input.vision);
178
+ }
179
+ }
180
+ upsertBlock(root, `[data-theme='${input.vision}']`, varsForTheme);
181
+ import_node_fs.default.writeFileSync(cssPath, root.toString(), "utf8");
182
+ console.log(`\u2705 [${input.vision}] theme updated in ${cssPath}`);
183
+ }
184
+ function inferRich(varName, baseHex) {
185
+ return variationRegex.test(varName) ? { base: baseHex, scale: true } : { base: baseHex, scale: false };
186
+ }
187
+ // Annotate the CommonJS export names for ESM import in node:
188
+ 0 && (module.exports = {
189
+ applyThemes
190
+ });
@@ -0,0 +1,5 @@
1
+ import { T as ThemeGenInput } from './types-1AdZPAhd.cjs';
2
+
3
+ declare function applyThemes(input: ThemeGenInput, cssPath?: string): void;
4
+
5
+ export { applyThemes };
@@ -0,0 +1,5 @@
1
+ import { T as ThemeGenInput } from './types-1AdZPAhd.js';
2
+
3
+ declare function applyThemes(input: ThemeGenInput, cssPath?: string): void;
4
+
5
+ export { applyThemes };
@@ -0,0 +1,153 @@
1
+ // src/node/applyThemes.ts
2
+ import fs from "fs";
3
+ import postcss, { Rule } from "postcss";
4
+ import safeParser from "postcss-safe-parser";
5
+
6
+ // src/utils/core/colorScale.ts
7
+ import Color from "colorjs.io";
8
+
9
+ // src/constants/variation.ts
10
+ var DEFAULT_KEYS = [
11
+ "50",
12
+ "100",
13
+ "200",
14
+ "300",
15
+ "400",
16
+ "500",
17
+ "600",
18
+ "700",
19
+ "800",
20
+ "900"
21
+ ];
22
+ var DEFAULT_SCALE = {
23
+ "50": { dL: 0.36, cMul: 0.95 },
24
+ "100": { dL: 0.28, cMul: 0.96 },
25
+ "200": { dL: 0.18, cMul: 0.98 },
26
+ "300": { dL: 0.08, cMul: 0.99 },
27
+ "400": { dL: 0.02, cMul: 1 },
28
+ "500": { dL: 0, cMul: 1 },
29
+ "600": { dL: -0.05, cMul: 0.98 },
30
+ "700": { dL: -0.15, cMul: 0.94 },
31
+ "800": { dL: -0.22, cMul: 0.9 },
32
+ "900": { dL: -0.3, cMul: 0.88 }
33
+ };
34
+
35
+ // src/utils/core/colorScale.ts
36
+ var CLAMP01 = (x) => Math.max(0, Math.min(1, x));
37
+ function hexToOKLCH(hex) {
38
+ const c = new Color(hex);
39
+ const o = c.to("oklch");
40
+ return { l: o.l, c: o.c, h: o.h ?? 0 };
41
+ }
42
+ function oklchToHex(l, c, h) {
43
+ const color = new Color("oklch", [l, c, h]);
44
+ const srgb = color.to("srgb");
45
+ const r = CLAMP01(srgb.r), g = CLAMP01(srgb.g), b = CLAMP01(srgb.b);
46
+ return new Color("srgb", [r, g, b]).toString({ format: "hex" });
47
+ }
48
+ function buildScaleFromBaseHex(baseHex, opts) {
49
+ const keys = opts?.keys ?? DEFAULT_KEYS;
50
+ const cMin = opts?.cMin ?? 0.02;
51
+ const cMax = opts?.cMax ?? 0.4;
52
+ const lockHue = true;
53
+ const base = hexToOKLCH(baseHex);
54
+ const out = {};
55
+ for (const k of keys) {
56
+ const pat = DEFAULT_SCALE[k] ?? DEFAULT_SCALE["500"];
57
+ const L = CLAMP01(base.l + pat.dL);
58
+ const C = Math.max(cMin, Math.min(cMax, base.c * pat.cMul));
59
+ const H = lockHue ? base.h : base.h;
60
+ out[k] = oklchToHex(L, C, H);
61
+ }
62
+ return out;
63
+ }
64
+
65
+ // src/constants/regex.ts
66
+ var variationRegex = /^--(.+?)-(50|100|200|300|400|500|600|700|800|900)$/i;
67
+
68
+ // src/node/applyThemes.ts
69
+ var CSS_PATH = "src/index.css";
70
+ function toThemeColor(hex, _vision) {
71
+ return hex;
72
+ }
73
+ function loadRoot(cssPath = CSS_PATH) {
74
+ const css = fs.readFileSync(cssPath, "utf8");
75
+ return postcss().process(css, { parser: safeParser }).root;
76
+ }
77
+ function getExistingKeysForToken(root, token) {
78
+ const keys = /* @__PURE__ */ new Set();
79
+ root.walkDecls((d) => {
80
+ if (!d.prop.startsWith("--")) return;
81
+ const m = d.prop.match(variationRegex);
82
+ if (!m) return;
83
+ const [, t, k] = m;
84
+ if (t === token) keys.add(k);
85
+ });
86
+ return Array.from(keys);
87
+ }
88
+ function upsertBlock(root, selector, kv) {
89
+ let rule;
90
+ root.walkRules((r) => {
91
+ if (r.selector === selector) rule = r;
92
+ });
93
+ if (!rule) {
94
+ rule = new Rule({ selector });
95
+ root.append(rule);
96
+ }
97
+ const remain = new Map(Object.entries(kv));
98
+ rule.walkDecls((d) => {
99
+ if (remain.has(d.prop)) {
100
+ d.value = remain.get(d.prop);
101
+ remain.delete(d.prop);
102
+ }
103
+ });
104
+ for (const [prop, value] of remain) rule.append({ prop, value });
105
+ }
106
+ function getColorVariablesFromRoot(root) {
107
+ const vars = {};
108
+ root.walkDecls((decl) => {
109
+ const name = decl.prop.trim();
110
+ const value = decl.value.trim();
111
+ if (name.startsWith("--color")) {
112
+ vars[name] = value;
113
+ }
114
+ });
115
+ return vars;
116
+ }
117
+ function applyThemes(input, cssPath = CSS_PATH) {
118
+ const root = loadRoot(cssPath);
119
+ const originalVars = getColorVariablesFromRoot(root);
120
+ const varsForTheme = {};
121
+ for (const [varName, value] of Object.entries(originalVars)) {
122
+ varsForTheme[varName] = value;
123
+ }
124
+ for (const [varName, val] of Object.entries(input.variables)) {
125
+ const rich = typeof val === "string" ? inferRich(varName, val) : val;
126
+ const m = varName.match(variationRegex);
127
+ const isPattern = !!m;
128
+ if (isPattern) {
129
+ const [, token] = m;
130
+ const keys = rich.keys && rich.keys.length ? rich.keys : getExistingKeysForToken(root, token).length ? getExistingKeysForToken(root, token) : Array.from(DEFAULT_KEYS);
131
+ if (rich.scale !== false) {
132
+ const scaleMap = buildScaleFromBaseHex(rich.base, { keys });
133
+ for (const k of keys) {
134
+ const hex = scaleMap[k];
135
+ varsForTheme[`--${token}-${k}`] = toThemeColor(hex, input.vision);
136
+ }
137
+ } else {
138
+ varsForTheme[varName] = toThemeColor(rich.base, input.vision);
139
+ }
140
+ } else {
141
+ varsForTheme[varName] = toThemeColor(rich.base, input.vision);
142
+ }
143
+ }
144
+ upsertBlock(root, `[data-theme='${input.vision}']`, varsForTheme);
145
+ fs.writeFileSync(cssPath, root.toString(), "utf8");
146
+ console.log(`\u2705 [${input.vision}] theme updated in ${cssPath}`);
147
+ }
148
+ function inferRich(varName, baseHex) {
149
+ return variationRegex.test(varName) ? { base: baseHex, scale: true } : { base: baseHex, scale: false };
150
+ }
151
+ export {
152
+ applyThemes
153
+ };
@@ -1,10 +1,10 @@
1
- <svg width="77" height="78" viewBox="0 0 77 78" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M0 34.6052L3.03172 27.5771L36.6562 11.7295L34.0379 18.3441L0 34.6052Z" fill="#CE78A9"/>
3
- <path d="M5.3745 47.4212L1.10254 37.6371L29.2148 23.4431L26.4587 30.1956L7.9928 39.5663L12.9538 51.0042L5.3745 47.4212Z" fill="#D55D00"/>
4
- <path d="M43.5491 0.478061L50.5423 3.58953L66.0064 37.3921L59.4219 34.6987L43.5491 0.478061Z" fill="#E59F01"/>
5
- <path d="M30.6731 5.70644L40.5052 1.54606L54.3785 29.818L47.6578 26.9852L38.4977 8.41393L27.0042 13.2445L30.6731 5.70644Z" fill="black"/>
6
- <path d="M33.0714 77.4894L26.0844 74.3641L10.6869 40.5311L17.2661 43.2375L33.0714 77.4894Z" fill="#0072B1"/>
7
- <path d="M45.9578 72.2865L36.1175 76.4275L22.3 48.1283L29.0151 50.9742L38.1385 69.5636L49.6416 64.7557L45.9578 72.2865Z" fill="#F0E442"/>
8
- <path d="M76.7775 43.4237L73.8143 50.481L40.3455 66.6549L42.8994 60.0151L76.7775 43.4237Z" fill="#009F73"/>
9
- <path d="M71.2787 30.661L75.6456 40.4032L47.6727 54.8699L50.363 48.0909L68.7369 38.541L63.6649 27.152L71.2787 30.661Z" fill="#56B4E8"/>
10
- </svg>
1
+ <svg width="77" height="78" viewBox="0 0 77 78" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 34.6052L3.03172 27.5771L36.6562 11.7295L34.0379 18.3441L0 34.6052Z" fill="#CE78A9"/>
3
+ <path d="M5.3745 47.4212L1.10254 37.6371L29.2148 23.4431L26.4587 30.1956L7.9928 39.5663L12.9538 51.0042L5.3745 47.4212Z" fill="#D55D00"/>
4
+ <path d="M43.5491 0.478061L50.5423 3.58953L66.0064 37.3921L59.4219 34.6987L43.5491 0.478061Z" fill="#E59F01"/>
5
+ <path d="M30.6731 5.70644L40.5052 1.54606L54.3785 29.818L47.6578 26.9852L38.4977 8.41393L27.0042 13.2445L30.6731 5.70644Z" fill="black"/>
6
+ <path d="M33.0714 77.4894L26.0844 74.3641L10.6869 40.5311L17.2661 43.2375L33.0714 77.4894Z" fill="#0072B1"/>
7
+ <path d="M45.9578 72.2865L36.1175 76.4275L22.3 48.1283L29.0151 50.9742L38.1385 69.5636L49.6416 64.7557L45.9578 72.2865Z" fill="#F0E442"/>
8
+ <path d="M76.7775 43.4237L73.8143 50.481L40.3455 66.6549L42.8994 60.0151L76.7775 43.4237Z" fill="#009F73"/>
9
+ <path d="M71.2787 30.661L75.6456 40.4032L47.6727 54.8699L50.363 48.0909L68.7369 38.541L63.6649 27.152L71.2787 30.661Z" fill="#56B4E8"/>
10
+ </svg>
@@ -1,5 +1,5 @@
1
- <svg width="28" height="29" viewBox="0 0 28 29" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.91" y="1.41" width="26.18" height="26.18" fill='none' rx="13.09" stroke="currentColor" stroke-width="1.82"/>
3
- <path d="M9.25244 7.15234H14.2974C15.4253 7.15234 16.3687 7.34717 17.1274 7.73682C17.8862 8.11963 18.4468 8.65625 18.8091 9.34668C19.1782 10.0303 19.3628 10.8232 19.3628 11.7256C19.3628 12.7305 19.1304 13.5952 18.6655 14.3198C18.2075 15.0444 17.5171 15.5674 16.5942 15.8887L19.937 22H17.7837L14.6768 16.2271L14.3179 16.2373H11.0981V22H9.25244V7.15234ZM14.2358 14.5557C15.3774 14.5557 16.2114 14.313 16.7378 13.8276C17.271 13.3423 17.5376 12.6416 17.5376 11.7256C17.5376 10.7959 17.271 10.0747 16.7378 9.56201C16.2046 9.04932 15.3638 8.79297 14.2153 8.79297H11.0981V14.5557H14.2358Z" fill="currentColor"/>
4
- <path d="M3.5 1.66602L26.8333 24.9993" fill='none' stroke="currentColor" stroke-width="1.51667"/>
5
- </svg>
1
+ <svg width="28" height="29" viewBox="0 0 28 29" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="0.91" y="1.41" width="26.18" height="26.18" fill='none' rx="13.09" stroke="currentColor" stroke-width="1.82"/>
3
+ <path d="M9.25244 7.15234H14.2974C15.4253 7.15234 16.3687 7.34717 17.1274 7.73682C17.8862 8.11963 18.4468 8.65625 18.8091 9.34668C19.1782 10.0303 19.3628 10.8232 19.3628 11.7256C19.3628 12.7305 19.1304 13.5952 18.6655 14.3198C18.2075 15.0444 17.5171 15.5674 16.5942 15.8887L19.937 22H17.7837L14.6768 16.2271L14.3179 16.2373H11.0981V22H9.25244V7.15234ZM14.2358 14.5557C15.3774 14.5557 16.2114 14.313 16.7378 13.8276C17.271 13.3423 17.5376 12.6416 17.5376 11.7256C17.5376 10.7959 17.271 10.0747 16.7378 9.56201C16.2046 9.04932 15.3638 8.79297 14.2153 8.79297H11.0981V14.5557H14.2358Z" fill="currentColor"/>
4
+ <path d="M3.5 1.66602L26.8333 24.9993" fill='none' stroke="currentColor" stroke-width="1.51667"/>
5
+ </svg>
@@ -1,5 +1,5 @@
1
- <svg width="28" height="29" viewBox="0 0 28 29" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.91" y="1.41" width="26.18" fill='none' height="26.18" rx="13.09" stroke="currentColor" stroke-width="1.82"/>
3
- <path d="M8.64062 7.15234H13.8496C14.8545 7.15234 15.6987 7.32324 16.3823 7.66504C17.0659 8.00684 17.5752 8.4751 17.9102 9.06982C18.252 9.66455 18.4229 10.3379 18.4229 11.0898C18.4229 11.9785 18.2007 12.6724 17.7563 13.1714C17.312 13.6636 16.7275 14.0088 16.0029 14.207V14.3506C16.4814 14.3779 16.9531 14.542 17.418 14.8428C17.8828 15.1436 18.2656 15.5708 18.5664 16.1245C18.8672 16.6714 19.0176 17.3174 19.0176 18.0625C19.0176 18.835 18.8398 19.5151 18.4844 20.103C18.1357 20.6909 17.5889 21.1558 16.8438 21.4976C16.0986 21.8325 15.1621 22 14.0342 22H8.64062V7.15234ZM14.0137 20.3594C15.1143 20.3594 15.9243 20.1475 16.4438 19.7236C16.9702 19.2998 17.2334 18.7393 17.2334 18.042C17.2334 17.5361 17.1035 17.0713 16.8438 16.6475C16.5908 16.2168 16.2251 15.8784 15.7466 15.6323C15.2749 15.3794 14.7314 15.2529 14.1162 15.2529H10.4863V20.3594H14.0137ZM13.7881 13.6533C14.3213 13.6533 14.8066 13.5508 15.2441 13.3457C15.6816 13.1338 16.0269 12.8364 16.2798 12.4536C16.5327 12.064 16.6592 11.6162 16.6592 11.1104C16.6592 10.4268 16.4233 9.86963 15.9517 9.43896C15.48 9.0083 14.7793 8.79297 13.8496 8.79297H10.4863V13.6533H13.7881Z" fill="currentColor"/>
4
- <path d="M3.5 1.66602L26.8333 24.9993" fill='none' stroke="currentColor" stroke-width="1.51667"/>
5
- </svg>
1
+ <svg width="28" height="29" viewBox="0 0 28 29" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="0.91" y="1.41" width="26.18" fill='none' height="26.18" rx="13.09" stroke="currentColor" stroke-width="1.82"/>
3
+ <path d="M8.64062 7.15234H13.8496C14.8545 7.15234 15.6987 7.32324 16.3823 7.66504C17.0659 8.00684 17.5752 8.4751 17.9102 9.06982C18.252 9.66455 18.4229 10.3379 18.4229 11.0898C18.4229 11.9785 18.2007 12.6724 17.7563 13.1714C17.312 13.6636 16.7275 14.0088 16.0029 14.207V14.3506C16.4814 14.3779 16.9531 14.542 17.418 14.8428C17.8828 15.1436 18.2656 15.5708 18.5664 16.1245C18.8672 16.6714 19.0176 17.3174 19.0176 18.0625C19.0176 18.835 18.8398 19.5151 18.4844 20.103C18.1357 20.6909 17.5889 21.1558 16.8438 21.4976C16.0986 21.8325 15.1621 22 14.0342 22H8.64062V7.15234ZM14.0137 20.3594C15.1143 20.3594 15.9243 20.1475 16.4438 19.7236C16.9702 19.2998 17.2334 18.7393 17.2334 18.042C17.2334 17.5361 17.1035 17.0713 16.8438 16.6475C16.5908 16.2168 16.2251 15.8784 15.7466 15.6323C15.2749 15.3794 14.7314 15.2529 14.1162 15.2529H10.4863V20.3594H14.0137ZM13.7881 13.6533C14.3213 13.6533 14.8066 13.5508 15.2441 13.3457C15.6816 13.1338 16.0269 12.8364 16.2798 12.4536C16.5327 12.064 16.6592 11.6162 16.6592 11.1104C16.6592 10.4268 16.4233 9.86963 15.9517 9.43896C15.48 9.0083 14.7793 8.79297 13.8496 8.79297H10.4863V13.6533H13.7881Z" fill="currentColor"/>
4
+ <path d="M3.5 1.66602L26.8333 24.9993" fill='none' stroke="currentColor" stroke-width="1.51667"/>
5
+ </svg>
@@ -0,0 +1,20 @@
1
+ type Vision = 'protanopia' | 'deuteranopia' | 'tritanopia';
2
+ type VariableInput = Record<string, VariableRich>;
3
+ interface VariableRich {
4
+ base: string;
5
+ scale: boolean;
6
+ keys?: string[];
7
+ anchor?: string;
8
+ }
9
+ interface ThemeGenInput {
10
+ vision: Vision;
11
+ variables: VariableInput;
12
+ }
13
+ interface ThemeGenInput {
14
+ vision: Vision;
15
+ variables: VariableInput;
16
+ }
17
+ type ScaleKeys = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
18
+ type Scale = Record<ScaleKeys, string>;
19
+
20
+ export type { ScaleKeys as S, ThemeGenInput as T, Scale as a };
@@ -0,0 +1,20 @@
1
+ type Vision = 'protanopia' | 'deuteranopia' | 'tritanopia';
2
+ type VariableInput = Record<string, VariableRich>;
3
+ interface VariableRich {
4
+ base: string;
5
+ scale: boolean;
6
+ keys?: string[];
7
+ anchor?: string;
8
+ }
9
+ interface ThemeGenInput {
10
+ vision: Vision;
11
+ variables: VariableInput;
12
+ }
13
+ interface ThemeGenInput {
14
+ vision: Vision;
15
+ variables: VariableInput;
16
+ }
17
+ type ScaleKeys = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
18
+ type Scale = Record<ScaleKeys, string>;
19
+
20
+ export type { ScaleKeys as S, ThemeGenInput as T, Scale as a };
package/package.json CHANGED
@@ -1,80 +1,80 @@
1
- {
2
- "name": "colbrush",
3
- "version": "1.0.0",
4
- "description": "",
5
- "type": "module",
6
- "main": "./dist/index.browser.js",
7
- "module": "./dist/index.browser.js",
8
- "types": "./dist/index.browser.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.browser.d.ts",
12
- "import": "./dist/index.browser.js",
13
- "require": "./dist/index.browser.cjs"
14
- },
15
- "./styles.css": "./dist/styles.css",
16
- "./client": {
17
- "types": "./dist/client.d.ts",
18
- "import": "./dist/client.js",
19
- "require": "./dist/client.cjs"
20
- },
21
- "./package.json": "./package.json"
22
- },
23
- "typesVersions": {
24
- "*": {
25
- "*": [
26
- "./dist/index.browser.d.ts"
27
- ]
28
- }
29
- },
30
- "files": [
31
- "dist"
32
- ],
33
- "sideEffects": [
34
- "dist/styles.css"
35
- ],
36
- "bin": {
37
- "colbrush": "./dist/cli.js"
38
- },
39
- "scripts": {
40
- "build": "tsup src/index.browser.ts src/client.ts src/cli.ts --format esm,cjs --dts && pnpm build:css",
41
- "build:css": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --minify",
42
- "dev": "tsup src/index.browser.ts --watch",
43
- "test": "jest --passWithNoTests",
44
- "prepublishOnly": "pnpm build"
45
- },
46
- "keywords": [],
47
- "author": "",
48
- "license": "MIT",
49
- "dependencies": {
50
- "chokidar": "^3.6.0",
51
- "chroma-js": "^3.1.2",
52
- "color-blind": "^0.1.3",
53
- "colorjs.io": "^0.5.2",
54
- "postcss": "^8.5.6",
55
- "postcss-safe-parser": "^7.0.1"
56
- },
57
- "peerDependencies": {
58
- "react": ">=17",
59
- "react-dom": ">=17"
60
- },
61
- "devDependencies": {
62
- "@tailwindcss/cli": "^4.1.12",
63
- "@types/chroma-js": "^3.1.1",
64
- "@types/jest": "^30.0.0",
65
- "@types/node": "^24.1.0",
66
- "@types/postcss-safe-parser": "^5.0.4",
67
- "@types/react": "^19.1.9",
68
- "@types/react-dom": "^19.1.7",
69
- "esbuild-plugin-svgr": "^3.1.1",
70
- "eslint": "^9.32.0",
71
- "eslint-config-prettier": "^10.1.8",
72
- "eslint-plugin-import": "^2.32.0",
73
- "jest": "^30.0.5",
74
- "prettier": "^3.6.2",
75
- "ts-jest": "^29.4.0",
76
- "tsup": "^8.5.0",
77
- "tailwindcss": "^4.1.12",
78
- "typescript": "^5.8.3"
79
- }
80
- }
1
+ {
2
+ "name": "colbrush",
3
+ "version": "1.0.1",
4
+ "description": "",
5
+ "type": "module",
6
+ "main": "./dist/index.browser.js",
7
+ "module": "./dist/index.browser.js",
8
+ "types": "./dist/index.browser.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.browser.d.ts",
12
+ "import": "./dist/index.browser.js",
13
+ "require": "./dist/index.browser.cjs"
14
+ },
15
+ "./styles.css": "./dist/styles.css",
16
+ "./client": {
17
+ "types": "./dist/client.d.ts",
18
+ "import": "./dist/client.js",
19
+ "require": "./dist/client.cjs"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "typesVersions": {
24
+ "*": {
25
+ "*": [
26
+ "./dist/index.browser.d.ts"
27
+ ]
28
+ }
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "sideEffects": [
34
+ "dist/styles.css"
35
+ ],
36
+ "bin": {
37
+ "colbrush": "./dist/cli.js"
38
+ },
39
+ "scripts": {
40
+ "build": "tsup src/index.browser.ts src/client.ts src/cli.ts --format esm,cjs --dts && pnpm build:css",
41
+ "build:css": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --minify",
42
+ "dev": "tsup src/index.browser.ts --watch",
43
+ "test": "jest --passWithNoTests",
44
+ "prepublishOnly": "pnpm build"
45
+ },
46
+ "keywords": [],
47
+ "author": "",
48
+ "license": "MIT",
49
+ "dependencies": {
50
+ "chokidar": "^3.6.0",
51
+ "chroma-js": "^3.1.2",
52
+ "color-blind": "^0.1.3",
53
+ "colorjs.io": "^0.5.2",
54
+ "postcss": "^8.5.6",
55
+ "postcss-safe-parser": "^7.0.1"
56
+ },
57
+ "peerDependencies": {
58
+ "react": ">=17",
59
+ "react-dom": ">=17"
60
+ },
61
+ "devDependencies": {
62
+ "@tailwindcss/cli": "^4.1.12",
63
+ "@types/chroma-js": "^3.1.1",
64
+ "@types/jest": "^30.0.0",
65
+ "@types/node": "^24.1.0",
66
+ "@types/postcss-safe-parser": "^5.0.4",
67
+ "@types/react": "^19.1.9",
68
+ "@types/react-dom": "^19.1.7",
69
+ "esbuild-plugin-svgr": "^3.1.1",
70
+ "eslint": "^9.32.0",
71
+ "eslint-config-prettier": "^10.1.8",
72
+ "eslint-plugin-import": "^2.32.0",
73
+ "jest": "^30.0.5",
74
+ "prettier": "^3.6.2",
75
+ "ts-jest": "^29.4.0",
76
+ "tsup": "^8.5.0",
77
+ "tailwindcss": "^4.1.12",
78
+ "typescript": "^5.8.3"
79
+ }
80
+ }