Skip to content

use canvas for color space conversion#2417

Merged
mbostock merged 12 commits intombostock/raster-color-spacefrom
mbostock/color-space
Apr 10, 2026
Merged

use canvas for color space conversion#2417
mbostock merged 12 commits intombostock/raster-color-spacefrom
mbostock/color-space

Conversation

@mbostock
Copy link
Copy Markdown
Member

No description provided.

@mbostock mbostock merged commit 78ce729 into mbostock/raster-color-space Apr 10, 2026
@mbostock mbostock deleted the mbostock/color-space branch April 10, 2026 17:29
@mbostock mbostock mentioned this pull request Apr 10, 2026
mbostock added a commit that referenced this pull request Apr 10, 2026
* raster colorSpace

* use canvas for color space conversion (#2417)

* Use context2D to convert CSS4 colors to display-p3

* * use the canvas converter for colors that d3.rgb can't parse (CSS4)
* memoize (with some decent limit) for faster renders
* clear rect to guard against semi-transparent color leaks

* support opacity in literal colors

* fix test

* prestier

* colorConverter option

* need colorCanvas to use oklch

* checkpoint

* remove colorConverter option

* memoize color scale, too

---------

Co-authored-by: Philippe Rivière <fil@rezo.net>

* handle null color

* revert color scale memoization

* remove unused import; fix test script

* defer colorConverter construction

* regenerate snapshots again?

* fix constant fill logic

---------

Co-authored-by: Philippe Rivière <fil@rezo.net>
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.

2 participants