@dilemmagx/palette 0.0.1
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/README.md +77 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +10518 -0
- package/dist/core.d.ts +81 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +7 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @dilemmagx/palette
|
|
2
|
+
|
|
3
|
+
Palette is a CLI + TypeScript toolkit that reads a single input (HEX, data URI, URL, or local path), detects its type automatically, and generates palettes.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @dilemmagx/palette
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## CLI
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
palette <input>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
palette ff7a18
|
|
21
|
+
palette ./image.png
|
|
22
|
+
palette https://example.com/image.jpg
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The CLI prints every algorithm by default. Each algorithm output is a single line of color blocks with readable text inside each block for easy selection and copying.
|
|
26
|
+
Palette sizes vary by algorithm, unless overridden.
|
|
27
|
+
|
|
28
|
+
Options:
|
|
29
|
+
|
|
30
|
+
- `-a, --algorithm <name>`: Print a single algorithm
|
|
31
|
+
- `-c, --count <number>`: Override palette size
|
|
32
|
+
|
|
33
|
+
Output:
|
|
34
|
+
|
|
35
|
+
- One header line per algorithm
|
|
36
|
+
- Three connected rows of color blocks with readable HEX labels
|
|
37
|
+
|
|
38
|
+
## Input Types
|
|
39
|
+
|
|
40
|
+
- HEX: `RRGGBB` or `RGB` in CLI (no leading `#`). In TypeScript, `#RRGGBB` and `#RGB` are accepted.
|
|
41
|
+
- Data URI: `data:image/...;base64,...`
|
|
42
|
+
- URL: `http://` or `https://`
|
|
43
|
+
- Path: local image path (default fallback)
|
|
44
|
+
|
|
45
|
+
## Algorithms
|
|
46
|
+
|
|
47
|
+
- analogous
|
|
48
|
+
- complementary
|
|
49
|
+
- triadic
|
|
50
|
+
- tetradic
|
|
51
|
+
- split-complementary
|
|
52
|
+
- monochrome
|
|
53
|
+
- monet
|
|
54
|
+
|
|
55
|
+
Monet uses image quantization and color scoring inspired by Material Color Utilities.
|
|
56
|
+
|
|
57
|
+
## TypeScript API
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import {
|
|
61
|
+
generatePalette,
|
|
62
|
+
generatePaletteFromHex,
|
|
63
|
+
generatePaletteFromDataUri,
|
|
64
|
+
generatePaletteFromUrl,
|
|
65
|
+
generatePaletteFromPath,
|
|
66
|
+
listAlgorithms,
|
|
67
|
+
} from "@dilemmagx/palette";
|
|
68
|
+
|
|
69
|
+
const result = await generatePalette("#ff7a18", { algorithm: "analogous" });
|
|
70
|
+
console.log(result.colors);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`generatePalette` detects the input type automatically. The other functions target a specific input type. Use `count` to override palette size.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
GPL-3.0
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|