html2canvas Fails on Tailwind CSS v4 oklch() Colors; Forks Offer Fixes
Calling html2canvas on pages styled with Tailwind CSS v4 can throw an 'unsupported color function' error because the library's parser does not recognize modern functions like oklch(). The issue stems from the official html2canvas 1.4.1 release predating these CSS color spaces, not from Tailwind itself. Two maintained alternatives are suggested: html2canvas-pro, a modern fork that supports these colors, and html2canvas-lts, a drop-in fork that adds parsing for them. Developers who must keep the official package can instead rewrite the captured elements' colors to rgb() or hex before rendering, though this is more laborious. The article credits the original library's author and notes that the forks are separate projects.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in