@nightshadeui/palette-generator 2.20.2 → 2.20.4
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.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +31 -0
- package/dist/cli.js.map +1 -0
- package/package.json +1 -1
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { generatePaletteCss } from './generate.js';
|
|
5
|
+
const program = new Command();
|
|
6
|
+
program
|
|
7
|
+
.name('palette-generator')
|
|
8
|
+
.description('Emit OKLCH palette as CSS custom properties')
|
|
9
|
+
.option('-f, --file <path>', 'read JSON palette spec from file (stdin if "-" )')
|
|
10
|
+
.option('-o, --output <path>', 'write to file instead of stdout')
|
|
11
|
+
.option('--raw', 'emit property lines only (no :root wrapper)')
|
|
12
|
+
.action((opts) => {
|
|
13
|
+
let palette = {};
|
|
14
|
+
if (opts.file) {
|
|
15
|
+
const raw = opts.file === '-'
|
|
16
|
+
? readFileSync(0, 'utf8')
|
|
17
|
+
: readFileSync(opts.file, 'utf8');
|
|
18
|
+
palette = JSON.parse(raw);
|
|
19
|
+
}
|
|
20
|
+
const css = generatePaletteCss(palette, {
|
|
21
|
+
selector: opts.raw ? false : ':root',
|
|
22
|
+
});
|
|
23
|
+
if (opts.output) {
|
|
24
|
+
writeFileSync(opts.output, css, 'utf8');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
process.stdout.write(`${css}\n`);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
program.parse();
|
|
31
|
+
//# sourceMappingURL=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