@diskette/palette 0.20.0 → 0.21.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 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.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 = 0; step <= 12; 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
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@diskette/palette",
3
3
  "type": "module",
4
- "version": "0.20.0",
4
+ "version": "0.21.0",
5
5
  "bin": {
6
6
  "palette": "./dist/cli/cli.js"
7
7
  },