Skip to content

add oklch colors by updating to @kurkle/color 0.6 - #12402

Open
Ph0tonic wants to merge 1 commit into
chartjs:masterfrom
Ph0tonic:chore/update-kurkle-color
Open

Ph0tonic wants to merge 1 commit into
chartjs:masterfrom
Ph0tonic:chore/update-kurkle-color

Conversation

@Ph0tonic

@Ph0tonic Ph0tonic commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Add support for CSS Color Level 4 oklch() colors by updating @kurkle/color from ^0.3.0 to ^0.6.6.

Fixes #12101

What changes for users

With 0.3.x, an oklch() color draws fine on the canvas, but @kurkle/color can't parse it:

  • color animations skip the transition and jump straight to the target color;
  • the default hover colors (hoverBackgroundColor, hoverBorderColor, hoverColor) are computed from an invalid color.

0.6.6 parses oklch(). It also accepts / as the alpha separator in hsl()/hwb(), accepts scientific notation in rgb(), and rounds rgb() percentages and fractional channels the way browsers do.

Why 0.6.6 and not an earlier 0.5.x/0.6.x release

From 0.5.0 to 0.6.5, @kurkle/color broke two things Chart.js relies on:

  • CommonJS runtime: require('@kurkle/color') only returned { default }, so Chart.js's CommonJS build threw color$1.Color is not a constructor from color() and getHoverColor().
  • Types with moduleResolution: "node": import { Color } from '@kurkle/color' in our declarations failed with TS2614. This is what made the typescript-node integration test fail on the first version of this PR.

Both are fixed upstream in 0.6.6 (kurkle/color@0cb8e9b), which also adds regression tests against Chart.js's CommonJS build and node10 types.

Changes

  • package.json / pnpm-lock.yaml: @kurkle/color ^0.6.6
  • test/specs/helpers.color.tests.js, test/specs/core.animation.tests.js: oklch() parsing, hover color and animation (they fail on 0.3.2)
  • test/integration/node-commonjs, test/integration/node: call color() and getHoverColor(), which would have caught the CommonJS crash
  • rebased on master (pnpm 12, Node 26, Rollup 4)

Testing

Locally, in Docker with Node 26 and pnpm 12.21.0, following the CI steps: pnpm run lint, Karma on Chrome and Firefox (3412/3412), and all integration tests.

Note: pnpm 12's minimumReleaseAge rejects 0.6.6 for 24 hours after it was published, so the rebased commit will be pushed once it is old enough. No exception was added to pnpm-workspace.yaml.

🤖 Generated with Claude Code

etimberg
etimberg previously approved these changes Nov 16, 2026
@Ph0tonic

Copy link
Copy Markdown
Contributor Author

I've just openned a pr to fixe the type import on @kurkle/color

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Ph0tonic
Ph0tonic force-pushed the chore/update-kurkle-color branch from 5b2cfb7 to 479662b Compare November 19, 2026 16:33
@etimberg

Copy link
Copy Markdown
Member
Lockfile is up to date, resolution step is skipped
Error: ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION

  × installing dependencies
  ╰─▶ 1 lockfile entries failed verification:
        @kurkle/color@0.6.6 was published at 2026-11-19T15:36:40.000Z, within
      the minimumReleaseAge cutoff (2026-11-18T16:33:52.378Z)

Will re-run the CI tomorrow and this shoudl pass and we can merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for CSS Level 4 Color Syntax (e.g. oklch(), space-separated hsl(), etc)

2 participants