@diskette/palette 0.20.0 → 0.21.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/dist/cli/cli.js +9 -0
- package/dist/css.d.ts +1 -1
- package/dist/css.js +4 -4
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -29,6 +29,11 @@ const main = defineCommand({
|
|
|
29
29
|
alias: 'o',
|
|
30
30
|
description: 'Output directory',
|
|
31
31
|
},
|
|
32
|
+
accents: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
alias: 'a',
|
|
35
|
+
description: 'Generate accents.css with [data-accent-color] selectors',
|
|
36
|
+
},
|
|
32
37
|
},
|
|
33
38
|
run({ args }) {
|
|
34
39
|
const selected = args._.filter((c) => allColors.includes(c));
|
|
@@ -47,6 +52,10 @@ const main = defineCommand({
|
|
|
47
52
|
writeIfNotExists(`${outputPath}/${name}-dark.css`, css.palette(color, { schemes: ['dark'], alpha: true }));
|
|
48
53
|
}
|
|
49
54
|
}
|
|
55
|
+
if (args.accents) {
|
|
56
|
+
const accentColorNames = selected.filter((c) => !alphaColors.includes(c));
|
|
57
|
+
writeIfNotExists(`${outputPath}/accents.css`, css.accents(accentColorNames));
|
|
58
|
+
}
|
|
50
59
|
const path = relative(dirname(packageJsonPath), resolve(outputPath));
|
|
51
60
|
console.log(`\nCSS saved to ${outputPath}`);
|
|
52
61
|
},
|
package/dist/css.d.ts
CHANGED
|
@@ -36,5 +36,5 @@ export declare const css: {
|
|
|
36
36
|
*/
|
|
37
37
|
tailwind: typeof tailwind;
|
|
38
38
|
};
|
|
39
|
-
export declare function applyColorVars(prefix: 'accent' | 'gray', color: PaletteColor<Color>, theme: 'light' | 'dark', space: 'srgb' | 'p3', set: (name: string
|
|
39
|
+
export declare function applyColorVars(prefix: 'accent' | 'gray', color: PaletteColor<Color>, theme: 'light' | 'dark', space: 'srgb' | 'p3', set: (name: `--${string}`, value: string) => void): void;
|
|
40
40
|
export {};
|
package/dist/css.js
CHANGED
|
@@ -154,12 +154,12 @@ export const css = {
|
|
|
154
154
|
};
|
|
155
155
|
export function applyColorVars(prefix, color, theme, space, set) {
|
|
156
156
|
const scale = color[theme][space];
|
|
157
|
-
for (let step =
|
|
158
|
-
set(`--${prefix}-${step}`, scale.solid[step]);
|
|
159
|
-
set(`--${prefix}-a${step}`, scale.alpha[step]);
|
|
157
|
+
for (let step = 1; step <= 12; step++) {
|
|
158
|
+
set(`--${prefix}-${step}`, scale.solid[step - 1]);
|
|
159
|
+
set(`--${prefix}-a${step}`, scale.alpha[step - 1]);
|
|
160
160
|
}
|
|
161
161
|
set(`--${prefix}-contrast`, color.contrast);
|
|
162
162
|
set(`--${prefix}-surface`, color.surface[theme][space]);
|
|
163
163
|
set(`--${prefix}-indicator`, scale.solid[color.indicator - 1]);
|
|
164
|
-
set(`--${prefix}-track`, scale.solid[color.track]);
|
|
164
|
+
set(`--${prefix}-track`, scale.solid[color.track - 1]);
|
|
165
165
|
}
|