@celestia-island/hikari 0.55.219 → 0.55.220

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.219",
3
+ "version": "0.55.220",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari UI library, Vue 3 runtime — one design system for Vue 3 and Rust/WASM applications",
@@ -229,18 +229,13 @@ describe("HkTreemap pure layout input", () => {
229
229
  ).toEqual({ nodes: [], total: 0 });
230
230
  });
231
231
 
232
- it("chooses readable label colours across pale, mid-tone and dark backgrounds", () => {
233
- expect(contrastTextColor("#edc948")).toBe("#0b1220");
234
- expect(contrastTextColor("#4e79a7")).toBe("#fff");
235
- expect(contrastTextColor("#76b7b2")).toBe("#0b1220");
236
- expect(contrastTextColor("rgb(242, 142, 43)")).toBe("#0b1220");
237
- expect(contrastTextColor("#abc")).toBe("#0b1220");
238
- expect(contrastTextColor("hsl(0, 0%, 100%)")).toBe("#0b1220");
239
- expect(contrastTextColor("not-a-color")).toBe("#fff");
240
- // Every default palette member must clear WCAG AA with its chosen text.
241
- for (const color of HK_TREEMAP_DEFAULT_COLORS) {
242
- expect(["#fff", "#0b1220"]).toContain(contrastTextColor(color));
243
- }
232
+ it("cell labels follow the theme icon/text token, not a per-block flip", () => {
233
+ // User direction 2026-10-28: cells read like icon glyphs — white on the
234
+ // dark theme via rgb(var(--color-text)), the same vocabulary as
235
+ // HkIconButton; the token flips the ink in the light theme.
236
+ expect(contrastTextColor("#edc948")).toBe("rgb(var(--color-text, 30 30 30))");
237
+ expect(contrastTextColor("#4e79a7")).toBe("rgb(var(--color-text, 30 30 30))");
238
+ expect(contrastTextColor("not-a-color")).toBe("rgb(var(--color-text, 30 30 30))");
244
239
  });
245
240
 
246
241
  it("builds an accessible leaf-path summary from the same layout", () => {
@@ -144,21 +144,18 @@ function resolveOpaqueColor(raw: string, fallback: string): string {
144
144
  return `rgb(${Math.round(channels[0])} ${Math.round(channels[1])} ${Math.round(channels[2])})`;
145
145
  }
146
146
 
147
- /** Pick the higher-contrast label colour for an opaque CSS background. */
148
- export function contrastTextColor(background: string): string {
149
- const channels = parseCssColor(background);
150
- if (!channels || channels[3] < 0.999) return "#fff";
151
- // sRGB relative luminance, with the standard gamma expansion. The two
152
- // candidate text colours (#fff / #0b1220) cross at luminance ~= 0.193.
153
- const linear = (channel: number) => {
154
- const value = channel / 255;
155
- return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
156
- };
157
- const luminance =
158
- 0.2126 * linear(channels[0]) +
159
- 0.7152 * linear(channels[1]) +
160
- 0.0722 * linear(channels[2]);
161
- return luminance > 0.193 ? "#0b1220" : "#fff";
147
+ /**
148
+ * Cell label colour — user direction 2026-10-28: the text inside the colour
149
+ * blocks should read like the family's icon glyphs (WHITE on the dark
150
+ * theme), not a per-block black/white flip that made mid-tone cells carry
151
+ * dark text. So the foreground simply follows the theme's icon/text token
152
+ * (`--hi-icon-color` resolves to `rgb(var(--color-text))`), the same
153
+ * vocabulary HkIconButton uses; the light theme keeps dark ink via the same
154
+ * token. The background argument is kept for signature compatibility and
155
+ * intentionally unused.
156
+ */
157
+ export function contrastTextColor(_background: string): string {
158
+ return "rgb(var(--color-text, 30 30 30))";
162
159
  }
163
160
 
164
161
  export const HK_TREEMAP_DEFAULT_COLORS = [