@diskette/palette 0.15.0 → 0.18.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.
- package/dist/cli/cli.js +11 -0
- package/dist/cli/commands/generate.d.ts +64 -0
- package/dist/cli/commands/generate.js +87 -0
- package/dist/cli/commands/list.d.ts +48 -0
- package/dist/cli/commands/list.js +33 -0
- package/dist/colors/amber.d.ts +1 -5
- package/dist/colors/amber.js +0 -4
- package/dist/colors/blue.d.ts +1 -5
- package/dist/colors/blue.js +0 -4
- package/dist/colors/bronze.d.ts +1 -5
- package/dist/colors/bronze.js +0 -4
- package/dist/colors/brown.d.ts +1 -5
- package/dist/colors/brown.js +0 -4
- package/dist/colors/crimson.d.ts +1 -5
- package/dist/colors/crimson.js +0 -4
- package/dist/colors/cyan.d.ts +1 -5
- package/dist/colors/cyan.js +0 -4
- package/dist/colors/gold.d.ts +1 -5
- package/dist/colors/gold.js +0 -4
- package/dist/colors/grass.d.ts +1 -5
- package/dist/colors/grass.js +0 -4
- package/dist/colors/gray.d.ts +1 -5
- package/dist/colors/gray.js +0 -4
- package/dist/colors/green.d.ts +1 -5
- package/dist/colors/green.js +0 -4
- package/dist/colors/indigo.d.ts +1 -5
- package/dist/colors/indigo.js +0 -4
- package/dist/colors/iris.d.ts +1 -5
- package/dist/colors/iris.js +0 -4
- package/dist/colors/jade.d.ts +1 -5
- package/dist/colors/jade.js +0 -4
- package/dist/colors/lime.d.ts +1 -5
- package/dist/colors/lime.js +0 -4
- package/dist/colors/mauve.d.ts +1 -5
- package/dist/colors/mauve.js +0 -4
- package/dist/colors/mint.d.ts +1 -5
- package/dist/colors/mint.js +0 -4
- package/dist/colors/olive.d.ts +1 -5
- package/dist/colors/olive.js +0 -4
- package/dist/colors/orange.d.ts +1 -5
- package/dist/colors/orange.js +0 -4
- package/dist/colors/pink.d.ts +1 -5
- package/dist/colors/pink.js +0 -4
- package/dist/colors/plum.d.ts +1 -5
- package/dist/colors/plum.js +0 -4
- package/dist/colors/purple.d.ts +1 -5
- package/dist/colors/purple.js +0 -4
- package/dist/colors/red.d.ts +1 -5
- package/dist/colors/red.js +0 -4
- package/dist/colors/ruby.d.ts +1 -5
- package/dist/colors/ruby.js +0 -4
- package/dist/colors/sage.d.ts +1 -5
- package/dist/colors/sage.js +0 -4
- package/dist/colors/sand.d.ts +1 -5
- package/dist/colors/sand.js +0 -4
- package/dist/colors/sky.d.ts +1 -5
- package/dist/colors/sky.js +0 -4
- package/dist/colors/slate.d.ts +1 -5
- package/dist/colors/slate.js +0 -4
- package/dist/colors/teal.d.ts +1 -5
- package/dist/colors/teal.js +0 -4
- package/dist/colors/tomato.d.ts +1 -5
- package/dist/colors/tomato.js +0 -4
- package/dist/colors/violet.d.ts +1 -5
- package/dist/colors/violet.js +0 -4
- package/dist/colors/yellow.d.ts +1 -5
- package/dist/colors/yellow.js +0 -4
- package/dist/css.d.ts +2 -2
- package/dist/css.js +0 -6
- package/dist/index.d.ts +3754 -3846
- package/dist/index.js +3 -2
- package/dist/types.d.ts +7 -7
- package/package.json +4 -4
- package/dist/cli/clit.d.ts +0 -1
- package/dist/cli/clit.js +0 -21
- package/dist/cli.js +0 -100
- /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import teal from "./colors/teal.js";
|
|
|
29
29
|
import tomato from "./colors/tomato.js";
|
|
30
30
|
import violet from "./colors/violet.js";
|
|
31
31
|
import yellow from "./colors/yellow.js";
|
|
32
|
-
export const colors =
|
|
32
|
+
export const colors = {
|
|
33
33
|
amber,
|
|
34
34
|
blue,
|
|
35
35
|
bronze,
|
|
@@ -61,7 +61,8 @@ export const colors = [
|
|
|
61
61
|
tomato,
|
|
62
62
|
violet,
|
|
63
63
|
yellow,
|
|
64
|
-
|
|
64
|
+
};
|
|
65
|
+
colors['amber'];
|
|
65
66
|
export default colors;
|
|
66
67
|
export { accentColors, grayColors } from "./types.js";
|
|
67
68
|
export { css } from "./css.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -4,18 +4,18 @@ export declare const accentColors: readonly ["gray", "gold", "bronze", "brown",
|
|
|
4
4
|
export type AccentColor = (typeof accentColors)[number];
|
|
5
5
|
export type Color = AccentColor | GrayColor;
|
|
6
6
|
type ScaleStep = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
7
|
-
export type
|
|
7
|
+
export type ScaleSteps<C extends Color> = {
|
|
8
8
|
[K in `${C}${ScaleStep}` | `${C}A${ScaleStep}`]: string;
|
|
9
9
|
};
|
|
10
|
-
export type
|
|
10
|
+
export type ColorScale<C extends Color> = {
|
|
11
11
|
name: C;
|
|
12
12
|
srgb: {
|
|
13
|
-
light:
|
|
14
|
-
dark:
|
|
13
|
+
light: ScaleSteps<C>;
|
|
14
|
+
dark: ScaleSteps<C>;
|
|
15
15
|
};
|
|
16
16
|
p3: {
|
|
17
|
-
light:
|
|
18
|
-
dark:
|
|
17
|
+
light: ScaleSteps<C>;
|
|
18
|
+
dark: ScaleSteps<C>;
|
|
19
19
|
};
|
|
20
20
|
contrast: string;
|
|
21
21
|
indicator: string;
|
|
@@ -31,7 +31,7 @@ export type ColorPalette<C extends Color> = {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
export type
|
|
34
|
+
export type AnyColorScale = ColorScale<any>;
|
|
35
35
|
export type AlphaScale<C extends 'white' | 'back'> = {
|
|
36
36
|
[K in `${C}A${ScaleStep}`]: string;
|
|
37
37
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diskette/palette",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.18.0",
|
|
5
5
|
"bin": {
|
|
6
|
-
"palette": "./dist/cli.js"
|
|
6
|
+
"palette": "./dist/cli/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"cleye": "^2.0.1",
|
|
27
|
+
"type-flag": "^4.0.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@changesets/cli": "^2.29.7",
|
package/dist/cli/clit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/cli/clit.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineCommand, runMain } from 'citty';
|
|
2
|
-
const main = defineCommand({
|
|
3
|
-
meta: {
|
|
4
|
-
name: 'citty',
|
|
5
|
-
// TODO: figure out way to get package.json version
|
|
6
|
-
version: '0.0.0',
|
|
7
|
-
description: '__desc__',
|
|
8
|
-
},
|
|
9
|
-
setup() {
|
|
10
|
-
console.log('Setup');
|
|
11
|
-
},
|
|
12
|
-
cleanup() {
|
|
13
|
-
console.log('Cleanup');
|
|
14
|
-
},
|
|
15
|
-
subCommands: {
|
|
16
|
-
// build: () => import('./commands/build').then((r) => r.default),
|
|
17
|
-
// deploy: () => import('./commands/deploy').then((r) => r.default),
|
|
18
|
-
// debug: () => import('./commands/debug').then((r) => r.default),
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
runMain(main);
|
package/dist/cli.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as p from '@clack/prompts';
|
|
2
|
-
import { mkdirSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
import { blackAlpha, whiteAlpha } from "./colors/index.js";
|
|
5
|
-
import { accentColors, colors, css, grayColors } from "./index.js";
|
|
6
|
-
function cancel() {
|
|
7
|
-
p.cancel('Operation cancelled.');
|
|
8
|
-
process.exit(0);
|
|
9
|
-
}
|
|
10
|
-
async function askColors(label, choices) {
|
|
11
|
-
const mode = await p.select({
|
|
12
|
-
message: `Which ${label} colors do you want to generate?`,
|
|
13
|
-
options: [
|
|
14
|
-
{ value: 'select', label: 'Select specific colors' },
|
|
15
|
-
{
|
|
16
|
-
value: 'all',
|
|
17
|
-
label: `All ${label} colors`,
|
|
18
|
-
hint: `${choices.length} colors`,
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
});
|
|
22
|
-
if (p.isCancel(mode))
|
|
23
|
-
cancel();
|
|
24
|
-
if (mode === 'all')
|
|
25
|
-
return choices;
|
|
26
|
-
const selected = await p.autocompleteMultiselect({
|
|
27
|
-
message: `Select ${label} colors:`,
|
|
28
|
-
options: choices.map((name) => ({ value: name, label: name })),
|
|
29
|
-
required: false,
|
|
30
|
-
});
|
|
31
|
-
if (p.isCancel(selected))
|
|
32
|
-
cancel();
|
|
33
|
-
return selected;
|
|
34
|
-
}
|
|
35
|
-
async function askOutputDir(message) {
|
|
36
|
-
const outputDir = await p.text({
|
|
37
|
-
message,
|
|
38
|
-
validate(value) {
|
|
39
|
-
if (!value) {
|
|
40
|
-
return 'Please enter a path';
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
const stat = statSync(resolve(process.cwd(), value));
|
|
44
|
-
if (!stat.isDirectory()) {
|
|
45
|
-
return 'Path must be a directory, not a file';
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch { }
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
if (p.isCancel(outputDir))
|
|
52
|
-
cancel();
|
|
53
|
-
return outputDir;
|
|
54
|
-
}
|
|
55
|
-
async function main() {
|
|
56
|
-
p.intro('Palette CSS Generator');
|
|
57
|
-
const selectedAccentColors = await askColors('accent', accentColors);
|
|
58
|
-
const selectedGrayColors = await askColors('gray', grayColors.slice(1));
|
|
59
|
-
const selectedColors = [...selectedAccentColors, ...selectedGrayColors];
|
|
60
|
-
const generateAccents = await p.confirm({
|
|
61
|
-
message: 'Generate accents for selected colors?',
|
|
62
|
-
});
|
|
63
|
-
if (p.isCancel(generateAccents))
|
|
64
|
-
cancel();
|
|
65
|
-
const outputDir = await askOutputDir('Output directory:');
|
|
66
|
-
// --- Generate Files ---
|
|
67
|
-
const outputPath = resolve(process.cwd(), outputDir);
|
|
68
|
-
mkdirSync(outputPath, { recursive: true });
|
|
69
|
-
for (const name of selectedColors) {
|
|
70
|
-
const palette = colors.find((c) => c.name === name);
|
|
71
|
-
// Light theme (scales + alphas + semantics)
|
|
72
|
-
writeFileSync(`${outputPath}/${name}.css`, css.palette(name, palette, { schemes: ['light'], alpha: true }));
|
|
73
|
-
// Dark theme (scales + alphas + semantics)
|
|
74
|
-
writeFileSync(`${outputPath}/${name}-dark.css`, css.palette(name, palette, { schemes: ['dark'], alpha: true }));
|
|
75
|
-
}
|
|
76
|
-
// Always generate alpha overlay files
|
|
77
|
-
writeFileSync(`${outputPath}/black-alpha.css`, css.alpha(blackAlpha));
|
|
78
|
-
writeFileSync(`${outputPath}/white-alpha.css`, css.alpha(whiteAlpha));
|
|
79
|
-
// Generate accents
|
|
80
|
-
if (generateAccents) {
|
|
81
|
-
const accents = css.accents([...selectedAccentColors]);
|
|
82
|
-
const grays = css.grays(selectedGrayColors, 'diskette-palette');
|
|
83
|
-
writeFileSync(`${outputPath}/accents.css`, `${accents}\n${grays}`);
|
|
84
|
-
}
|
|
85
|
-
// Generate Tailwind theme with imports
|
|
86
|
-
const imports = [
|
|
87
|
-
'./accents.css',
|
|
88
|
-
...selectedColors.flatMap((name) => [
|
|
89
|
-
`./${name}.css`,
|
|
90
|
-
`./${name}-dark.css`,
|
|
91
|
-
]),
|
|
92
|
-
'./black-alpha.css',
|
|
93
|
-
'./white-alpha.css',
|
|
94
|
-
]
|
|
95
|
-
.map((path) => `@import '${path}';`)
|
|
96
|
-
.join('\n');
|
|
97
|
-
writeFileSync(`${outputPath}/index.css`, `${imports}\n\n${css.tailwind(['white', 'black', 'accent', ...selectedColors])}`);
|
|
98
|
-
p.outro(`CSS saved to ${outputPath}`);
|
|
99
|
-
}
|
|
100
|
-
main().catch(console.error);
|
|
File without changes
|