@diskette/palette 0.23.1 → 0.23.2

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 CHANGED
@@ -25,7 +25,7 @@ const grayOptions = grayColors.map((c) => {
25
25
  return { value: c, label: `${swatch}${capitalize(c)}` };
26
26
  });
27
27
  async function main() {
28
- p.intro(`palette v0.23.1`);
28
+ p.intro(`palette v0.23.2`);
29
29
  const results = await p.group({
30
30
  colors: () => p.groupMultiselect({
31
31
  message: 'Select accent colors',
@@ -77,6 +77,7 @@ async function main() {
77
77
  // Build file list, confirm overwrites, and write
78
78
  const allFiles = buildOutputFiles({
79
79
  colors: allColors,
80
+ grays: selectedGrays,
80
81
  outputPath,
81
82
  accents: results.accents,
82
83
  tailwind: results.tailwind,
@@ -10,6 +10,7 @@ export type WriteResult = {
10
10
  };
11
11
  export declare function buildOutputFiles(config: {
12
12
  colors: string[];
13
+ grays: string[];
13
14
  outputPath: string;
14
15
  accents?: boolean;
15
16
  tailwind?: boolean;
@@ -36,11 +36,17 @@ function paletteColorFiles(name, outputPath) {
36
36
  },
37
37
  ];
38
38
  }
39
- function accentsFile(colorNames, outputPath) {
39
+ function accentsFile(colorNames, grayNames, outputPath) {
40
40
  return {
41
41
  path: `${outputPath}/accents.css`,
42
42
  displayName: 'Accents',
43
- content: () => css.accents(colorNames),
43
+ content: () => {
44
+ const parts = [css.accents(colorNames)];
45
+ if (grayNames.length > 0) {
46
+ parts.push(css.grays(grayNames));
47
+ }
48
+ return parts.join('\n');
49
+ },
44
50
  };
45
51
  }
46
52
  function tailwindFile(names, outputPath, accents) {
@@ -51,7 +57,7 @@ function tailwindFile(names, outputPath, accents) {
51
57
  };
52
58
  }
53
59
  export function buildOutputFiles(config) {
54
- const { colors, outputPath, accents, tailwind } = config;
60
+ const { colors, grays, outputPath, accents, tailwind } = config;
55
61
  const files = [];
56
62
  for (const name of colors) {
57
63
  if (isAlphaColor(name)) {
@@ -65,7 +71,7 @@ export function buildOutputFiles(config) {
65
71
  }
66
72
  if (accents) {
67
73
  const colorNames = colors.filter((c) => !isAlphaColor(c));
68
- files.push(accentsFile(colorNames, outputPath));
74
+ files.push(accentsFile(colorNames, grays, outputPath));
69
75
  }
70
76
  if (tailwind) {
71
77
  const tailwindNames = colors.map((c) => c === 'blackAlpha' ? 'black' : c === 'whiteAlpha' ? 'white' : c);
package/dist/css.d.ts CHANGED
@@ -12,7 +12,7 @@ type PaletteOptions = {
12
12
  declare function palette<C extends Color>(config: PaletteColor<C>, options?: PaletteOptions): string;
13
13
  declare function alpha(config: AlphaConfig): string;
14
14
  declare function accents(colorNames: string[]): string;
15
- declare function grays(names: readonly string[], className: string): string;
15
+ declare function grays(names: readonly string[], className?: string): string;
16
16
  type TailwindOptions = {
17
17
  /** Include @import for accents.css. Defaults to false */
18
18
  accents?: boolean;
package/dist/css.js CHANGED
@@ -80,7 +80,7 @@ function accents(colorNames) {
80
80
  output.push(formatRule(`[data-accent-color]:where(:not([data-accent-color=''], [data-accent-color='gray']))`, [...focus, ...focusAlpha]));
81
81
  return output.join('\n\n') + '\n';
82
82
  }
83
- function grays(names, className) {
83
+ function grays(names, className = 'diskette-theme') {
84
84
  const grays = names.filter((n) => n !== 'gray');
85
85
  const blocks = grays.map((colorName) => {
86
86
  const srgb = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@diskette/palette",
3
3
  "type": "module",
4
- "version": "0.23.1",
4
+ "version": "0.23.2",
5
5
  "bin": {
6
6
  "palette": "./dist/cli/cli.js"
7
7
  },