@diskette/palette 0.16.0 → 0.19.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.
Files changed (72) hide show
  1. package/dist/cli/commands/generate.d.ts +0 -10
  2. package/dist/cli/commands/generate.js +22 -23
  3. package/dist/colors/amber.d.ts +12 -112
  4. package/dist/colors/amber.js +115 -114
  5. package/dist/colors/blue.d.ts +12 -112
  6. package/dist/colors/blue.js +115 -114
  7. package/dist/colors/bronze.d.ts +12 -112
  8. package/dist/colors/bronze.js +115 -114
  9. package/dist/colors/brown.d.ts +12 -112
  10. package/dist/colors/brown.js +115 -114
  11. package/dist/colors/crimson.d.ts +12 -112
  12. package/dist/colors/crimson.js +115 -114
  13. package/dist/colors/cyan.d.ts +12 -112
  14. package/dist/colors/cyan.js +115 -114
  15. package/dist/colors/gold.d.ts +12 -112
  16. package/dist/colors/gold.js +115 -114
  17. package/dist/colors/grass.d.ts +12 -112
  18. package/dist/colors/grass.js +115 -114
  19. package/dist/colors/gray.d.ts +12 -112
  20. package/dist/colors/gray.js +115 -114
  21. package/dist/colors/green.d.ts +12 -112
  22. package/dist/colors/green.js +115 -114
  23. package/dist/colors/indigo.d.ts +12 -112
  24. package/dist/colors/indigo.js +115 -114
  25. package/dist/colors/iris.d.ts +12 -112
  26. package/dist/colors/iris.js +115 -114
  27. package/dist/colors/jade.d.ts +12 -112
  28. package/dist/colors/jade.js +115 -114
  29. package/dist/colors/lime.d.ts +12 -112
  30. package/dist/colors/lime.js +115 -114
  31. package/dist/colors/mauve.d.ts +12 -112
  32. package/dist/colors/mauve.js +115 -114
  33. package/dist/colors/mint.d.ts +12 -112
  34. package/dist/colors/mint.js +115 -114
  35. package/dist/colors/olive.d.ts +12 -112
  36. package/dist/colors/olive.js +115 -114
  37. package/dist/colors/orange.d.ts +12 -112
  38. package/dist/colors/orange.js +115 -114
  39. package/dist/colors/pink.d.ts +12 -112
  40. package/dist/colors/pink.js +115 -114
  41. package/dist/colors/plum.d.ts +12 -112
  42. package/dist/colors/plum.js +115 -114
  43. package/dist/colors/purple.d.ts +12 -112
  44. package/dist/colors/purple.js +115 -114
  45. package/dist/colors/red.d.ts +12 -112
  46. package/dist/colors/red.js +115 -114
  47. package/dist/colors/ruby.d.ts +12 -112
  48. package/dist/colors/ruby.js +115 -114
  49. package/dist/colors/sage.d.ts +12 -112
  50. package/dist/colors/sage.js +115 -114
  51. package/dist/colors/sand.d.ts +12 -112
  52. package/dist/colors/sand.js +115 -114
  53. package/dist/colors/sky.d.ts +12 -112
  54. package/dist/colors/sky.js +115 -114
  55. package/dist/colors/slate.d.ts +12 -112
  56. package/dist/colors/slate.js +115 -114
  57. package/dist/colors/teal.d.ts +12 -112
  58. package/dist/colors/teal.js +115 -114
  59. package/dist/colors/tomato.d.ts +12 -112
  60. package/dist/colors/tomato.js +115 -114
  61. package/dist/colors/violet.d.ts +12 -112
  62. package/dist/colors/violet.js +115 -114
  63. package/dist/colors/yellow.d.ts +12 -112
  64. package/dist/colors/yellow.js +115 -114
  65. package/dist/css.d.ts +2 -2
  66. package/dist/css.js +6 -11
  67. package/dist/index.d.ts +622 -3690
  68. package/dist/index.js +3 -3
  69. package/dist/types.d.ts +9 -12
  70. package/dist/utils.d.ts +1 -0
  71. package/dist/utils.js +8 -0
  72. package/package.json +1 -3
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,8 +61,8 @@ export const colors = [
61
61
  tomato,
62
62
  violet,
63
63
  yellow,
64
- ];
64
+ };
65
65
  export default colors;
66
66
  export { accentColors, grayColors } from "./types.js";
67
67
  export { css } from "./css.js";
68
- export { getMatchingGrayColor } from "./utils.js";
68
+ export { getMatchingGrayColor, toVarName } from "./utils.js";
package/dist/types.d.ts CHANGED
@@ -3,19 +3,17 @@ export type GrayColor = (typeof grayColors)[number];
3
3
  export declare const accentColors: readonly ["gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky"];
4
4
  export type AccentColor = (typeof accentColors)[number];
5
5
  export type Color = AccentColor | GrayColor;
6
- type ScaleStep = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
7
- export type ScaleSteps<C extends Color> = {
8
- [K in `${C}${ScaleStep}` | `${C}A${ScaleStep}`]: string;
9
- };
10
- export type ColorScale<C extends Color> = {
6
+ type Tuple<T, N extends number, R extends T[] = []> = R['length'] extends N ? R : Tuple<T, N, [...R, T]>;
7
+ type ScaleSteps = Tuple<string, 24>;
8
+ export interface PaletteColor<C extends Color> {
11
9
  name: C;
12
10
  srgb: {
13
- light: ScaleSteps<C>;
14
- dark: ScaleSteps<C>;
11
+ light: ScaleSteps;
12
+ dark: ScaleSteps;
15
13
  };
16
14
  p3: {
17
- light: ScaleSteps<C>;
18
- dark: ScaleSteps<C>;
15
+ light: ScaleSteps;
16
+ dark: ScaleSteps;
19
17
  };
20
18
  contrast: string;
21
19
  indicator: string;
@@ -30,10 +28,9 @@ export type ColorScale<C extends Color> = {
30
28
  dark: string;
31
29
  };
32
30
  };
33
- };
34
- export type AnyColorScale = ColorScale<any>;
31
+ }
35
32
  export type AlphaScale<C extends 'white' | 'back'> = {
36
- [K in `${C}A${ScaleStep}`]: string;
33
+ [K in `${C}A${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`]: string;
37
34
  };
38
35
  export type AlphaConfig<C extends 'white' | 'back'> = {
39
36
  name: C;
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { AccentColor, GrayColor } from './types.ts';
2
+ export declare function writeFileIfNotExists(path: string, data: string | NodeJS.ArrayBufferView): boolean;
2
3
  export declare function getMatchingGrayColor(accentColor: AccentColor): GrayColor;
3
4
  export declare const LIGHT_SELECTOR = ":root, .light, .light-theme";
4
5
  export declare const DARK_SELECTOR = ".dark, .dark-theme";
package/dist/utils.js CHANGED
@@ -1,3 +1,11 @@
1
+ import { existsSync, writeFileSync } from 'node:fs';
2
+ export function writeFileIfNotExists(path, data) {
3
+ if (existsSync(path)) {
4
+ return false;
5
+ }
6
+ writeFileSync(path, data);
7
+ return true;
8
+ }
1
9
  export function getMatchingGrayColor(accentColor) {
2
10
  switch (accentColor) {
3
11
  case 'tomato':
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@diskette/palette",
3
3
  "type": "module",
4
- "version": "0.16.0",
4
+ "version": "0.19.0",
5
5
  "bin": {
6
6
  "palette": "./dist/cli/cli.js"
7
7
  },
@@ -28,9 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@changesets/cli": "^2.29.7",
31
- "@diskette/fs": "^0.16.0",
32
31
  "@types/node": "^24.3.0",
33
- "magicast": "^0.5.1",
34
32
  "oxlint": "^1.16.0",
35
33
  "oxlint-tsgolint": "^0.2.0",
36
34
  "prettier": "^3.6.2",