Skip to content

Support for CSS Level 4 Color Syntax (e.g. oklch(), space-separated hsl(), etc) #12101

@dmitrystas

Description

@dmitrystas

Feature Proposal

Description:

Chart.js currently doesn't have full support for modern CSS Level 4 color formats, like:

oklch(.623 .214 259.815)
color(display-p3 0.27 0.49 0.99)
hsl(216.89 100% 59.61% / 90%) (space-separated notation)

etc.

While these formats are increasingly supported across modern browsers and work fine within Chart.js when used directly as solid colors, they fail in some scenarios - for example, in animations:

animation: {
  numbers: { duration: 0 },
  colors: {
    type: "color",
    duration: 1000,
    from: "transparent",
  }
}

You can see the issue in action here: https://codepen.io/jwvqbbzv-the-looper/pen/RNWWzaG

Feature Request:

Please consider adding support for CSS Level 4 color formats, including oklch(), lab(), color(), and the updated space-separated hsl()/rgb() notation. Native browser support is already quite strong, and support in Chart.js would greatly improve flexibility and modern color handling.

Why it's important:

These formats are increasingly standard and used in modern CSS workflows.

They allow for perceptual color spaces (oklch, lab) and better control for accessibility and color contrast.

Currently, Chart.js users must work around limitations or avoid using animations with modern colors altogether.

Thank you!

Possible Implementation

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions