html2canvas icon indicating copy to clipboard operation
html2canvas copied to clipboard

How is the 【oklch】 palette compatible

Open lihongyao opened this issue 11 months ago • 4 comments

The project used Tailwind CSS, but the color palette in Tailwind CSS 4.0 changed from rgb (red, green and blue) to oklch (Oklab Color Space), resulting in the following error when using html2canvas:

Error: Attempting to parse an unsupported color function "oklch"

lihongyao avatar Mar 12 '25 08:03 lihongyao

Hi @lihongyao! I just forked and added support for OKLCH here: https://github.com/nicastelo/html2canvas.

It is ready to install from npm as npm install html2canvas-oklch.

I didn’t test it much tbh, but it worked fine for me.

I also sent a PR to this repo here: https://github.com/niklasvh/html2canvas/pull/3236, although I still need to write some tests before it can be merged -- That in case this is still maintained

nicastelo avatar Mar 13 '25 21:03 nicastelo

still

Thank you very much~

lihongyao avatar Mar 19 '25 03:03 lihongyao

@nicastelo I believe that the most up-to-date version is now ours. We welcome every contributor, as that lib is far from our roadmap.

Sharcoux avatar Apr 20 '25 09:04 Sharcoux

try npmjs.com/package/html2canvas-pro, it supports color function oklch.

yorickshan avatar Nov 10 '25 08:11 yorickshan