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

Issue

I’m using html2canvas version 1.4.1. I’m not able to render the canvas properly because of the following error:

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

Seems like oklch is not supported, how to fix this?

Solution

There is an open ticket on github to address this issue but still no development has been done.

To fix this, I suggest switching to html2canvas-pro, it’s a fork of html2canvas so it has exactly the same api, but it supports all the modern color libraries like color, lab, lch, oklab, oklch.