hextimator 0.12.1 → 0.12.2
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/CHANGELOG.md +9 -3
- package/README.md +58 -22
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.12.2
|
|
2
|
+
|
|
3
|
+
### Patch Changes
|
|
4
|
+
|
|
5
|
+
- [#159](https://github.com/fgrgic/hextimator/pull/159) [`6155be2`](https://github.com/fgrgic/hextimator/commit/6155be275afd33bd653bba9db9eac48ab4a83053) Thanks [@fgrgic](https://github.com/fgrgic)! - docs: refresh README and package description
|
|
6
|
+
|
|
1
7
|
## 0.12.1
|
|
2
8
|
|
|
3
9
|
### Patch Changes
|
|
@@ -12,7 +18,7 @@
|
|
|
12
18
|
|
|
13
19
|
- [#150](https://github.com/fgrgic/hextimator/pull/150) [`b7800b9`](https://github.com/fgrgic/hextimator/commit/b7800b9fac32fe3ef245f60ed39c954c63e73785) Thanks [@fgrgic](https://github.com/fgrgic)! - Adds foreground anchored variants
|
|
14
20
|
|
|
15
|
-
You can add a new variant from foreground now. By default it will be the one that has the lowest still in
|
|
21
|
+
You can add a new variant from foreground now. By default it will be the one that has the lowest still in-range contrast ratio with its surface.
|
|
16
22
|
|
|
17
23
|
The generation logic can also be overwritten by providing custom `emphasis` value (e.g. `emphasis: -0.1`)
|
|
18
24
|
|
|
@@ -24,7 +30,7 @@
|
|
|
24
30
|
|
|
25
31
|
- [#142](https://github.com/fgrgic/hextimator/pull/142) [`95875bf`](https://github.com/fgrgic/hextimator/commit/95875bf4889c2120626cad00cfe54c6ea8f6b9dc) Thanks [@fgrgic](https://github.com/fgrgic)! - Widens the default POSITIVE_RANGE to be [120, 180].
|
|
26
32
|
|
|
27
|
-
The previous range was
|
|
33
|
+
The previous range was too limiting so you could get an accent color that is green, and a positive color that is a whole other green that doesn't match.
|
|
28
34
|
|
|
29
35
|
Technically it changes the algorithm so it's a breaking change, but it's a minor change that should improve the color generation algorithm.
|
|
30
36
|
|
|
@@ -46,7 +52,7 @@
|
|
|
46
52
|
|
|
47
53
|
### Minor Changes
|
|
48
54
|
|
|
49
|
-
- [#127](https://github.com/fgrgic/hextimator/pull/127) [`d0bbf5a`](https://github.com/fgrgic/hextimator/commit/d0bbf5a41ba303c18228057baf9b4ba6dfb016cd) Thanks [@fgrgic](https://github.com/fgrgic)! - - **Breaking.**: Lightness of the theme is derived from the input color's lightness by default. To pin down exact lightness, provide `light.baseLightness`, and/or `dark.
|
|
55
|
+
- [#127](https://github.com/fgrgic/hextimator/pull/127) [`d0bbf5a`](https://github.com/fgrgic/hextimator/commit/d0bbf5a41ba303c18228057baf9b4ba6dfb016cd) Thanks [@fgrgic](https://github.com/fgrgic)! - - **Breaking.**: Lightness of the theme is derived from the input color's lightness by default. To pin down exact lightness, provide `light.baseLightness`, and/or `dark.baseLightness`
|
|
50
56
|
|
|
51
57
|
- Exposes `baseLightnessRange` at the top level and under `light` / `dark` to bound OKLCH **L** for accent and semantic anchors. Defaults: light `[0.4, 0.9]`, dark `[0.2, 0.8]`. CLI: `--base-lightness-range`, `--light-base-lightness-range`, `--dark-base-lightness-range`.
|
|
52
58
|
|
package/README.md
CHANGED
|
@@ -1,27 +1,45 @@
|
|
|
1
1
|
# hextimator
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<
|
|
5
|
-
<img src="https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/assets/gh-cover.webp?raw=true" alt="hextimator" width="500">
|
|
6
|
-
</picture>
|
|
4
|
+
<img src="https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/assets/gh-cover.gif?raw=true" alt="hextimator" width="600">
|
|
7
5
|
</p>
|
|
6
|
+
<p>
|
|
7
|
+
<a href="https://www.npmjs.com/package/hextimator"><img src="https://img.shields.io/npm/v/hextimator" alt="npm version"></a>
|
|
8
|
+
<a href="https://github.com/fgrgic/hextimator/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/fgrgic/hextimator/test.yml?branch=main" alt="CI status"></a>
|
|
9
|
+
<a href="https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/LICENSE.md"><img src="https://img.shields.io/npm/l/hextimator" alt="license"></a>
|
|
10
|
+
<a href="https://bundlejs.com/?q=hextimator&treeshake=[{hextimate}]"><img src="https://img.shields.io/bundlejs/size/hextimator" alt="bundle size"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
Runtime theming for multi-tenant apps.
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
Your customers pick a brand color. Your app looks good every time. No per-customer design reviews. No manual tuning. Yellow does not break your UI.
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
Each call takes under a millisecond (~0.4ms [^perf]). Same color and options always produce the same tokens. Run it on the request path. Cache it if you want.
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
~12 kB min+gzip. Zero dependencies.
|
|
14
20
|
|
|
15
|
-
Try it
|
|
21
|
+
Try it: **[hextimator.com](https://hextimator.com)**
|
|
16
22
|
|
|
17
23
|
## Why `hextimator` exists
|
|
18
24
|
|
|
19
|
-
You
|
|
25
|
+
You ship a B2B, B2B2C, or white-label app. Every tenant brings a brand color. Your choices today:
|
|
26
|
+
|
|
27
|
+
- **Let them pick any hex.** Legal-pad yellow buttons become unreadable. Cheeto tangerine toasts look like your warning state.
|
|
28
|
+
- **Curate a palette.** You tell a paying customer their brand color is not allowed.
|
|
29
|
+
|
|
30
|
+
hextimator is the third option. **One color in, whole theme out.** Light and dark. Semantic roles and surfaces. Foregrounds meet WCAG contrast by default (AAA unless you opt down). Even yellow.
|
|
20
31
|
|
|
21
|
-
|
|
22
|
-
- **Curate a palette**. Now you are telling a paying customer their brand color is not allowed.
|
|
32
|
+
## How it compares
|
|
23
33
|
|
|
24
|
-
hextimator is
|
|
34
|
+
hextimator is not the first palette generator. It targets one job the others skip: arbitrary brand colors at runtime.
|
|
35
|
+
|
|
36
|
+
- **[Adobe Leonardo](https://leonardocolor.io)** Contrast-driven scales with manual control. Designers build palettes ahead of time. No runtime API for arbitrary hex, semantic roles, or dark mode.
|
|
37
|
+
- **[Material dynamic color](https://github.com/material-foundation/material-color-utilities)** Full theming from one seed color. Battle-tested on Android. Output follows Material's token scheme. Hard to use outside Material-shaped UIs.
|
|
38
|
+
- **[Radix Colors](https://www.radix-ui.com/colors)** Hand-tuned scales with strong semantics. Fixed curated set. Does not generate themes from arbitrary input.
|
|
39
|
+
- **[tints.dev](https://tints.dev) / [uicolors.app](https://uicolors.app)** Quick Tailwind shade scales from one color. Build-time only. No semantic roles, contrast guarantees, dark theme, or library API.
|
|
40
|
+
- **[culori](https://culorijs.org) / [chroma.js](https://gka.github.io/chroma.js/)** Color math and conversions. You build a generator with these. They are not generators.
|
|
41
|
+
|
|
42
|
+
Hand-crafting one brand's design system? Several of these beat hextimator. Color comes from user input (tenants, white-label customers, CMS authors)? That is hextimator's job.
|
|
25
43
|
|
|
26
44
|
## Installation
|
|
27
45
|
|
|
@@ -29,7 +47,7 @@ hextimator is option three. **One color in, whole theme out.** Light and dark. S
|
|
|
29
47
|
npm i hextimator
|
|
30
48
|
```
|
|
31
49
|
|
|
32
|
-
**Tailwind v4:** import `hextimator/tailwind.css` in your CSS entry (see [Tailwind](docs/tailwind.md)).
|
|
50
|
+
**Tailwind v4:** import `hextimator/tailwind.css` in your CSS entry (see [Tailwind](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/tailwind.md)).
|
|
33
51
|
|
|
34
52
|
## 30-second integration
|
|
35
53
|
|
|
@@ -39,9 +57,9 @@ import { hextimate } from "hextimator";
|
|
|
39
57
|
const css = hextimate("#C0FFEE").format({ as: "css" });
|
|
40
58
|
```
|
|
41
59
|
|
|
42
|
-
`hextimate` turns one color into theme
|
|
60
|
+
`hextimate` turns one color into a theme. You choose how to ship it: inline `<style>`, a `.css` file, a template partial, an edge cache, or something else. For tokens instead of a stylesheet, use `format({ as: 'object' })`.
|
|
43
61
|
|
|
44
|
-
Pure computation
|
|
62
|
+
No DOM. Pure computation. Works with SSR.
|
|
45
63
|
|
|
46
64
|
### React (SSR-safe)
|
|
47
65
|
|
|
@@ -51,11 +69,11 @@ import { HextimatorStyle } from "hextimator/react";
|
|
|
51
69
|
<HextimatorStyle color={"#0FF1CE"} />;
|
|
52
70
|
```
|
|
53
71
|
|
|
54
|
-
|
|
72
|
+
Put it in your layout `<head>`. Server render writes a `<style>` node. No `useEffect`. No FOUC when you pair it with static HTML. API and dark mode: [React](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/react.md).
|
|
55
73
|
|
|
56
74
|
### CLI (and AI agents)
|
|
57
75
|
|
|
58
|
-
|
|
76
|
+
Same engine as the library. Flags for presets and format.
|
|
59
77
|
|
|
60
78
|
```bash
|
|
61
79
|
npx hextimator '#BADA55' --preset shadcn # framework-shaped tokens
|
|
@@ -74,16 +92,16 @@ npx hextimator '#BADA55' --preset bold
|
|
|
74
92
|
| negative | DEFAULT, strong, weak, foreground |
|
|
75
93
|
| caution | DEFAULT, strong, weak, foreground |
|
|
76
94
|
|
|
77
|
-
Plus **`brand-exact`** (your input color,
|
|
95
|
+
Plus **`brand-exact`** (your input color, unchanged) and **`brand-exact-foreground`**.
|
|
78
96
|
|
|
79
97
|
## Customization and reference
|
|
80
98
|
|
|
81
|
-
- [Customization](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/customization.md): style and format options
|
|
99
|
+
- [Customization](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/customization.md): style and format options
|
|
82
100
|
- [Extending the palette](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/extending-the-palette.md): `addRole`, `addVariant`, `addToken`
|
|
83
|
-
- [Presets](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/presets.md):
|
|
101
|
+
- [Presets](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/presets.md): shadcn/ui configs and custom presets
|
|
84
102
|
- [Multiple themes](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/multiple-themes.md): dynamic theming and `.fork()`
|
|
85
103
|
- [React](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/react.md): hook, `HextimatorStyle`, provider, scoped themes, dark mode
|
|
86
|
-
- [Tailwind CSS v4](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/tailwind.md): setup and usage
|
|
104
|
+
- [Tailwind CSS v4](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/tailwind.md): setup and usage
|
|
87
105
|
|
|
88
106
|
### Also
|
|
89
107
|
|
|
@@ -91,8 +109,26 @@ Plus **`brand-exact`** (your input color, unmodified) and **`brand-exact-foregro
|
|
|
91
109
|
- [Examples](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/examples.md)
|
|
92
110
|
- [Migration](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md)
|
|
93
111
|
|
|
112
|
+
## Contrast methodology
|
|
113
|
+
|
|
114
|
+
WCAG 2.x contrast ratios. AAA by default. Opt down with `minContrastRatio`. Audits and compliance tooling still measure this way.
|
|
115
|
+
|
|
116
|
+
APCA is the perceptual model in draft WCAG 3. Better for a lot of UI. Not what pass/fail checks ask for yet. Optional support is planned when WCAG 3 settles.
|
|
117
|
+
|
|
118
|
+
## Stability
|
|
119
|
+
|
|
120
|
+
The API follows strict semver. Builder methods, options, formats, CLI flags, and token names only break in majors, with notes in migration.md.
|
|
121
|
+
|
|
122
|
+
Generated color values are a separate contract. Output is fully deterministic: same version, same color, same options, same tokens. The algorithm itself may improve in minors (wider hue ranges, better anchors), which changes the exact values a theme produces. Every such change is flagged in the changelog with how to opt back into the old behavior.
|
|
123
|
+
|
|
124
|
+
In practice:
|
|
125
|
+
|
|
126
|
+
- Pin an exact version if you cache or snapshot generated output.
|
|
127
|
+
- Patches only change generated values to fix bugs.
|
|
128
|
+
- Contrast guarantees hold across all releases. Whatever changes, foregrounds meet your configured minimum against their backgrounds.
|
|
129
|
+
|
|
94
130
|
## Contributing
|
|
95
131
|
|
|
96
|
-
|
|
132
|
+
Open issues and PRs at [github.com/fgrgic/hextimator](https://github.com/fgrgic/hextimator/issues).
|
|
97
133
|
|
|
98
|
-
[^perf]: Measured on
|
|
134
|
+
[^perf]: Measured on Apple Silicon M2 Max with Bun. Ballpark only. Your hardware and runtime will differ.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hextimator",
|
|
3
|
-
"version": "0.12.
|
|
4
|
-
"description": "Runtime theming for multi-tenant apps
|
|
3
|
+
"version": "0.12.2",
|
|
4
|
+
"description": "Runtime theming for multi-tenant apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"color-palette",
|
|
7
7
|
"palette-generator",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "git+https://github.com/fgrgic/hextimator.git"
|
|
23
|
+
"url": "git+https://github.com/fgrgic/hextimator.git",
|
|
24
|
+
"directory": "packages/hextimator"
|
|
24
25
|
},
|
|
25
26
|
"license": "MIT",
|
|
26
27
|
"engines": {
|