Skip to content

Add ColorSequence and Plotly Express qualitative color sequences - #439

Open
iynehz wants to merge 1 commit into
plotly:mainfrom
iynehz:feat-qualitative-color-sequences
Open

iynehz wants to merge 1 commit 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

  • ColorSequencelen(), 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.rscommon/color/mod.rs (+ pub mod qualitative)
  • common/qualitative.rscommon/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.

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
@iynehz
iynehz force-pushed the feat-qualitative-color-sequences branch from ba48ad9 to 909742c Compare September 23, 2026 20:00

This branch has not been deployed

No deployments
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

1 participant