Skip to content

[BUG]: Color validator rejects CSS color formats that plotly.js accepts #5867

Closed as not planned

Description

@ShawnNotFound

Description

The ColorValidator docstring says all CSS4 color formats are supported, but several color strings that plotly.js parses and renders are rejected on the Python side, for example lab(50% -40 59.5), oklab(0.6 0.1 -0.05), color(srgb 1 0 0), hsl(0.5turn 60% 40%), hsl(-30, 50%, 50%), rgb(1e2, 0, 0), rgb(255 0 0 / none) and transparent.

The regex only allows unsigned numbers, deg as the only angle unit, no none, and only a limited form of color(). plotly.js 4 parses colors with culori, which accepts all of the above.

Screenshots/Video

Not applicable, it's an error on the Python side.

Steps to reproduce

import plotly.graph_objects as go

go.Scatter(marker_color="lab(50% -40 59.5)")
ValueError: Invalid value of type 'builtins.str' received for the 'color' property of scatter.marker

Notes

plotly 7.1.0, Python 3.13. I have a fix ready and can open a PR.

Activity

  1. added
    bug
    on Nov 3, 2026
  2. KoolADE85 commented on Nov 4, 2026

    @KoolADE85
    Contributor

    Thanks for the report! Since you opened #5868, our team will review that and follow up.

  3. KoolADE85 commented on Nov 23, 2026

    @KoolADE85
    Contributor

    Since this issue doesn't describe a use-case that is blocking anyone actively, I'm going to close it and the PR as not-planned.
    If you encounter this issue in your regular usage of the library, feel free to reopen and we will reconsider the implementation.
    Thanks for the report @ShawnNotFound !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3bugsize: 1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions