Skip to content

Add ColorSequence and Plotly Express qualitative color sequences - #439

Merged
andrei-ng merged 2 commits into
plotly:mainfrom
iynehz:feat-qualitative-color-sequences
Nov 22, 2026
Merged

andrei-ng merged 2 commits into
plotly:mainfrom
iynehz:feat-qualitative-color-sequences

Conversation

@iynehz

@iynehz iynehz commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #396

Adds plotly::color::qualitative with a ColorSequence type and all 19 sequences from Plotly.py's plotly.colors.qualitative module (px.colors.qualitative), plus reversed (*_R) variants matching Python's *_r lists.

API

  • ColorSequence — len(), is_empty(), const get() with modular indexing, reversed(), iter() (non-allocating Iter), as_vec(), IntoIterator
  • Constants: PLOTLY, D3, G10, T10, Alphabet, Dark24, Light24, Set1, Pastel1, Dark2, Set2, Pastel2, Set3, Antique, Bold, Pastel, Prism, Safe, Vivid (+ each *_R)
  • ALL: &[(&str, ColorSequence)] and case-insensitive by_name() for name-based lookup

Notes

Checks

  • cargo fmt (new file clean under nightly)
  • cargo clippy --features all -- -D warnings -A deprecated
  • cargo test -p plotly (387 unit + 34 doc, including 9 new qualitative unit tests and 2 new doc examples)

@iynehz

iynehz commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

CI note: Clippy, Tests, examples, coverage, typos are green.

Rustfmt and semver fail for reasons that also fail on current main (verified on a clean upstream/main worktree):

  • Rustfmt: current nightly rewraps comments (wrap_comments = true); 22+ pre-existing files diff. The new qualitative.rs is clean under nightly rustfmt.
  • semver: cargo-semver-checks with the action’s feature set hits plotly_static’s “only one of geckodriver/chromedriver” compile_error while building rustdoc — also fails on main. Has been red on recent main runs (e.g. since July).

This PR only adds public items (plotly::qualitative), so it should be minor-compatible once those checks are fixed on the base branch.

@iynehz
iynehz force-pushed the feat-qualitative-color-sequences branch from cb21109 to ba48ad9 Compare September 23, 2026 19:33
@iynehz

iynehz commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Updated path to nest under the existing color module (same PR, force-pushed):

use plotly::color::qualitative;

qualitative::DARK24.get(0)
plotly::color::qualitative::ColorSequence
  • common/color.rs → common/color/mod.rs (+ pub mod qualitative)
  • common/qualitative.rs → common/color/qualitative.rs
  • Removed top-level plotly::qualitative re-export (it was never on a release)

Still additive for plotly::color::{Rgb, NamedColor, Color} users.

@iynehz
iynehz force-pushed the feat-qualitative-color-sequences branch from ba48ad9 to 909742c Compare September 23, 2026 20:00
@andrei-ng

andrei-ng commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

@iynehz , thank you for the PR. A bit busy atm. I will review it next week

@andrei-ng
andrei-ng force-pushed the feat-qualitative-color-sequences branch 2 times, most recently from 2f7ca5d to abc4992 Compare November 22, 2026 15:15
dependabot Bot and others added 2 commits November 22, 2026 16:25
* build(deps): update zip requirement from 8.0 to 9.4

 -  don't bump zip on kaleido (legacy and deprecated)

Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com>
Add plotly::color::qualitative with ColorSequence (len, modular get,
reversed) and all 19 px.colors.qualitative sequences plus reversed
*_R variants, sourced from plotly.py 7.1.0.

Fixes plotly#396

Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com>
@andrei-ng
andrei-ng force-pushed the feat-qualitative-color-sequences branch from abc4992 to 7b1c5f1 Compare November 22, 2026 15:26
@andrei-ng
andrei-ng merged commit b61ec32 into plotly:main Nov 22, 2026
34 checks passed
@andrei-ng

Copy link
Copy Markdown
Collaborator

Thank you for the PR! @iynehz

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Plotly Express color sequences

2 participants