@tenphi/glaze 0.0.0-snapshot.365f18a → 0.0.0-snapshot.38d4d4e
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/AGENTS.md +132 -0
- package/README.md +3 -2
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/docs/api.md +11 -7
- package/package.json +11 -2
package/docs/api.md
CHANGED
|
@@ -1909,10 +1909,12 @@ import {
|
|
|
1909
1909
|
|
|
1910
1910
|
### Format writers
|
|
1911
1911
|
|
|
1912
|
-
Every writer takes `h` on 0–360 and `s` / `l` / `t` on **0–1** — the
|
|
1913
|
-
|
|
1912
|
+
Every writer takes `h` on 0–360 and `s` / `l` / `t` on **0–1** — the scale every
|
|
1913
|
+
conversion above *returns*, and the scale `resolve()` stores in a
|
|
1914
1914
|
`ResolvedColorVariant`. The percentages are an output detail: the writers scale
|
|
1915
|
-
by 100 themselves where the CSS syntax asks for one.
|
|
1915
|
+
by 100 themselves where the CSS syntax asks for one. (The one thing on a
|
|
1916
|
+
different scale is the pair of tone transfers below, `toTone` / `fromTone`,
|
|
1917
|
+
which speak the 0–100 tone axis the authoring API takes.)
|
|
1916
1918
|
|
|
1917
1919
|
```ts
|
|
1918
1920
|
import {
|
|
@@ -1935,9 +1937,11 @@ between:
|
|
|
1935
1937
|
|
|
1936
1938
|
```ts
|
|
1937
1939
|
const v = glaze.color('#7A4DBF').resolve().light;
|
|
1940
|
+
const { h, s, l } = variantToOkhsl(v);
|
|
1938
1941
|
|
|
1939
1942
|
formatOkhst(v.h, v.s, v.t); // 'okhst(298.52 70.41% 45.02%)'
|
|
1940
|
-
|
|
1943
|
+
formatOkhsl(h, s, l); // 'okhsl(298.52 70.41% 45.27%)'
|
|
1944
|
+
formatRgb(h, s, l); // 'rgb(122 77 191)'
|
|
1941
1945
|
```
|
|
1942
1946
|
|
|
1943
1947
|
A value above 1 can only be pre-2.0 percentage-scale input, so the writers
|
|
@@ -1962,12 +1966,12 @@ import {
|
|
|
1962
1966
|
|
|
1963
1967
|
| Function | Description |
|
|
1964
1968
|
| ------------------------------------------- | ------------------------------------------------------------------------- |
|
|
1965
|
-
| `toTone(l, eps?)` | OKHSL lightness (0–1) → tone (0–100). Defaults to `REF_EPS`.
|
|
1966
|
-
| `fromTone(t, eps?)` | Tone (0–100) → OKHSL lightness (0–1). Inverse of `toTone`.
|
|
1969
|
+
| `toTone(l, eps?)` | OKHSL lightness (0–1) → tone (**0–100**, the authoring scale — divide by 100 for `formatOkhst`). Defaults to `REF_EPS`. |
|
|
1970
|
+
| `fromTone(t, eps?)` | Tone (**0–100**) → OKHSL lightness (0–1). Inverse of `toTone`. |
|
|
1967
1971
|
| `toneFromY(y, eps?)` / `yFromTone(t, eps?)` | Same transfer in luminance space (0–1). |
|
|
1968
1972
|
| `okhstToOkhsl({ h, s, t })` | OKHST → OKHSL (`{ h, s, l }`). |
|
|
1969
1973
|
| `okhslToOkhst({ h, s, l })` | OKHSL → OKHST (`{ h, s, t }`). |
|
|
1970
|
-
| `variantToOkhsl(variant)` | `ResolvedColorVariant` (stores `t`) → `{ h, s, l
|
|
1974
|
+
| `variantToOkhsl(variant)` | `ResolvedColorVariant` (stores `t`) → `{ h, s, l }` for rendering (`alpha` stays on the variant). |
|
|
1971
1975
|
| `REF_EPS` | Reference epsilon (`0.05`) for the canonical tone axis. |
|
|
1972
1976
|
|
|
1973
1977
|
`ResolvedColorVariant` stores `{ h, s, t, alpha }` (tone, not lightness). Use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/glaze",
|
|
3
|
-
"version": "0.0.0-snapshot.
|
|
3
|
+
"version": "0.0.0-snapshot.38d4d4e",
|
|
4
4
|
"description": "OKHST-based color theme generator with WCAG contrast solving for light, dark, and high-contrast schemes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
-
"docs"
|
|
23
|
+
"docs",
|
|
24
|
+
"AGENTS.md"
|
|
24
25
|
],
|
|
25
26
|
"sideEffects": false,
|
|
26
27
|
"engines": {
|
|
@@ -28,6 +29,10 @@
|
|
|
28
29
|
},
|
|
29
30
|
"scripts": {
|
|
30
31
|
"build": "tsdown",
|
|
32
|
+
"docs": "astro dev",
|
|
33
|
+
"docs:doctor": "cookbook doctor",
|
|
34
|
+
"build:docs": "astro build",
|
|
35
|
+
"build:site": "pnpm build:docs && GLAZE_SITE=true vite build playground",
|
|
31
36
|
"playground": "vite playground",
|
|
32
37
|
"build:playground": "vite build playground",
|
|
33
38
|
"test": "vitest run",
|
|
@@ -69,9 +74,13 @@
|
|
|
69
74
|
"@changesets/changelog-github": "^0.5.2",
|
|
70
75
|
"@changesets/cli": "^2.29.8",
|
|
71
76
|
"@eslint/js": "^10.0.1",
|
|
77
|
+
"@tenphi/cookbook": "^0.31.1",
|
|
78
|
+
"astro": "^7.3.3",
|
|
72
79
|
"eslint": "^10.0.0",
|
|
73
80
|
"eslint-config-prettier": "^10.1.8",
|
|
74
81
|
"prettier": "^3.8.1",
|
|
82
|
+
"react": "^19.2.8",
|
|
83
|
+
"react-dom": "^19.2.8",
|
|
75
84
|
"tsdown": "^0.20.3",
|
|
76
85
|
"typescript": "^5.9.3",
|
|
77
86
|
"typescript-eslint": "^8.56.0",
|