Skip to content

html2canvas: Attempting to parse an unsupported color function "oklch" when using Tailwind CSS v4 #3269

Description

@Abbeyf123

Hi! I’m running into an issue when trying to generate PDFs or screenshots with html2canvas while using Tailwind CSS v4, which now outputs colors in the oklch() format by default.

When html2canvas tries to parse elements styled with Tailwind colors (e.g. bg-green-500), it throws this error:

Attempting to parse an unsupported color function "oklch"

Environment

  • html2canvas version: 1.4.1 (latest as of now)
  • Tailwind CSS version: 4.0.0 (using new okLCH color syntax)
  • Browser: Chrome 141
  • Framework: Next.js 15
  • OS: Windows 11

🙏 Request

Can support for oklch() and oklab() color parsing be added in a future release?
Tailwind v4+ now uses these by default, so this will affect a large portion of frontend developers using html2canvas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions