From 772ae7ed8a6f0fc8601fb4d6a7214634c36abdc5 Mon Sep 17 00:00:00 2001 From: ShawnNotFound Date: Mon, 2 Nov 2026 22:02:45 +0000 Subject: [PATCH 1/2] Accept CSS color syntax supported by plotly.js in ColorValidator Allow signed and exponent numbers, angle units other than deg, the none keyword, any color() color space and the transparent keyword. These are all accepted by plotly.js 4 but were rejected by the Python validator. --- _plotly_utils/basevalidators.py | 25 ++++++++++++------- .../validators/test_color_validator.py | 18 +++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/_plotly_utils/basevalidators.py b/_plotly_utils/basevalidators.py index 1ffc63e5add..610d3166600 100644 --- a/_plotly_utils/basevalidators.py +++ b/_plotly_utils/basevalidators.py @@ -1138,13 +1138,24 @@ class ColorValidator(BaseValidator): }, """ - re_spaces_to_remove = re.compile(r"(? Date: Tue, 3 Nov 2026 00:07:39 +0000 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1632f922032..98832f2ea60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Fix `mpl_to_plotly` conversion of matplotlib contour lines and line collections: close contour rings ending with `Z` codes, support dash styles, convert date x-axes, separate disjoint subpaths with `None` separators, hide line collection traces from the legend by default, and group consecutive same-style lines into single traces [[#5770](https://github.com/plotly/plotly.py/pull/5770)], with thanks to @robertoffmoura for the contribution! - Fix `plotly.io.write_images` ignoring `layout.width`/`layout.height` (and the template's) and exporting every figure at the default 700x500 size; it now uses the same width/height priority as `write_image` and `to_image` [[#5784](https://github.com/plotly/plotly.py/pull/5784)], with thanks to @breken-ai for the contribution! - Fix color utilities mutating the list of colors passed to them [[#5836](https://github.com/plotly/plotly.py/pull/5836)], with thanks to @Enesuygurs for the contribution! +- Accept CSS color formats that plotly.js supports but the color validator rejected, such as negative `lab()`/`oklab()` components, `color()` values, angle units other than `deg`, the `none` keyword and `transparent` [[#5868](https://github.com/plotly/plotly.py/pull/5868)], with thanks to @ShawnNotFound for the contribution! ## [7.1.0] - 2026-09-15