Repository navigation
feat(color-picker): consolidate remaining legacy color selectors onto ColorPickerControl - #42910
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #42910 +/- ##
==========================================
+ Coverage 85.00% 85.22% +0.21%
==========================================
Files 3080 3093 +13
Lines 209266 212340 +3074
Branches 49296 49923 +627
==========================================
+ Hits 177894 180964 +3070
+ Misses 27990 27951 -39
- Partials 3382 3425 +43
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Nice consolidation, and the one-commit-per-item structure keeps it bisectable with real backward-compat handling on each swap (legacy interval_color_indices / comparison_color_scheme fallbacks, additive optional fields). One process question: this bundles four unrelated areas (Gauge, Bullet, Big Number PoP, Theme editor), each with its own new control dir and backward-compat surface — might be worth confirming maintainers are fine reviewing it as a single PR vs splitting per area. Minor: ThemeColorPickers re-parses the JSON textarea on each render (the useMemo keyed on jsonData mitigates it). |
There was a problem hiding this comment.
Pull request overview
Consolidates legacy chart and theme color selection onto the shared ColorPickerControl.
Changes:
- Adds per-interval Gauge and per-range Bullet color controls.
- Adds independent Big Number comparison colors with legacy fallback logic.
- Adds curated theme-token pickers and related tests.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/features/themes/ThemeModal.tsx |
Integrates curated theme color pickers. |
src/features/themes/ThemeModal.test.tsx |
Tests modal/picker synchronization. |
src/features/themes/ThemeColorPickers.tsx |
Implements theme token color editing. |
src/features/themes/ThemeColorPickers.test.tsx |
Tests parsing, patching, and interactions. |
src/explore/components/controls/IntervalColorsControl/types.ts |
Defines Gauge color-control props. |
src/explore/components/controls/IntervalColorsControl/IntervalColorsControl.test.tsx |
Tests Gauge interval color UI. |
src/explore/components/controls/IntervalColorsControl/index.tsx |
Implements Gauge interval color UI. |
src/explore/components/controls/index.ts |
Registers the new controls. |
src/explore/components/controls/ColorPickerControl.tsx |
Exports semantic color definitions. |
src/explore/components/controls/BulletRangeColorsControl/types.ts |
Defines Bullet color-control props. |
src/explore/components/controls/BulletRangeColorsControl/index.tsx |
Implements Bullet range color UI. |
src/explore/components/controls/BulletRangeColorsControl/BulletRangeColorsControl.test.tsx |
Tests Bullet range color UI. |
plugins/plugin-chart-echarts/test/Gauge/transformProps.test.ts |
Tests Gauge color rendering and fallback. |
plugins/plugin-chart-echarts/test/Bullet/transformProps.test.ts |
Tests Bullet custom band colors. |
plugins/plugin-chart-echarts/src/Gauge/types.ts |
Adds Gauge interval color form data. |
plugins/plugin-chart-echarts/src/Gauge/transformProps.ts |
Applies Gauge colors with legacy fallback. |
plugins/plugin-chart-echarts/src/Gauge/controlPanel.tsx |
Replaces the legacy Gauge color field. |
plugins/plugin-chart-echarts/src/Bullet/types.ts |
Adds Bullet range color form data. |
plugins/plugin-chart-echarts/src/Bullet/transformProps.ts |
Applies colors to sorted Bullet bands. |
plugins/plugin-chart-echarts/src/Bullet/controlPanel.tsx |
Adds the Bullet range color control. |
plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/utils.ts |
Adds comparison color resolution helpers. |
plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/utils.test.ts |
Tests comparison color resolution. |
plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/types.ts |
Adds new comparison color properties. |
plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts |
Passes comparison colors to the component. |
plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/PopKPI.tsx |
Applies customizable comparison colors. |
plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/PopKPI.test.tsx |
Tests comparison rendering variants. |
plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/controlPanel.ts |
Adds increase/decrease color pickers. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
96ba402 to
43e60b5
Compare
|
Heya @sha174n, thanks for the read-through! Given each swap already lands as its own bisectable commit with its own backward-compat handling, I'm inclined to keep this bundled rather than split it four ways at this point. Happy to reconsider if another maintainer feels strongly about it. And yeah, the useMemo already covers the re-parse cost, as you noted. |
Code Review Agent Run #c05116Actionable Suggestions - 0Additional Suggestions - 7
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
9b6b41e to
5ec5ad2
Compare
Code Review Agent Run #e29137Actionable Suggestions - 0Additional Suggestions - 7
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
5ec5ad2 to
3d4241f
Compare
…view legend, PopKPI color tests - Keep interval_color_indices registered as a hidden Gauge control so Explore (which builds query/save form data from registered controls) still hands a legacy chart's palette-relative colors to the renderer and keeps them on save, instead of previewing positional colors and dropping the indices on resave. - While the last interval bound is being retyped, let the legacy index count set the floor for the written color array so the first color edit in that window doesn't persist a shorter explicit array and flip the retyped band to a positional color. - Route custom Bullet range_colors through a per-layer color scale in the MCP Vega-Lite preview instead of a fixed value, so ranges keep their legend entries. - Make PopKPI's arrow indicator a styled span (like the pill) so the resolved comparison colors are real style rules, and assert the arrow and pill colors in its tests instead of only that the arrow renders. - Pin the row count in the blank-token IntervalColorsControl test and assert a change attempt doesn't commit. Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…used Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…reset, Gauge description Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…their keys; fix pot typo Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…hows the live theme color Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A theme swatch sharing its hex with the resolved Green/Red (colorSuccess) was being stored as the special key, turning ordinary Table conditional formatting rules into trend rules. Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… are unresolved Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…colors and unresolvable legacy indices Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… value array and unresolved legacy indices Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ounds; pin non-positional legacy Gauge indices Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… opt-in Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…abel contrast, ranges comparison Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…er shorthand hex theme Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…t over translucent bands Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…se theme tokens Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ure black/white Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…esolved Gauge bands Big Number PoP increase/decrease pickers now display the semantic color the chart falls back to (including the reversed legacy Red scheme) while unset, via a display-only `fallbackValue` on ColorPickerControl. Gauge interval colors explain why rows are read-only when legacy indices point past the static palette, and offer an explicit "Use scheme colors" action that seeds editable colors. Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aminghadersohi
left a comment
There was a problem hiding this comment.
The two new Gauge notice strings are missing from messages.pot; three smaller color notes are inline.
Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aminghadersohi
left a comment
There was a problem hiding this comment.
One ordering nit on the new messages.pot entry.
…al-key collisions and carried-over colors - Don't map shorthand hex theme tokens back by name; expand shorthand in the comparison pill tint - Keep Green/Red chips distinct from colorSuccess/colorError swatches when both are offered - Paint RGB objects carried over from Waterfall/Candlestick in Big Number period-over-period - Bullet: only defer label contrast outward for translucent fills - MCP Bullet preview: paint custom range colors at full strength - Sort new messages.pot entries; refresh stale comments; add tests Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
aminghadersohi
left a comment
There was a problem hiding this comment.
Approving; one non-blocking note.
Nit: Switching a Big Number comparison chart to Waterfall or Candlestick carries Green/Red into pickers that show them as CSS green/red while the chart paints its defaults, so a reversed chart's swatches are the opposite of its bars.
SUMMARY
Follow-up to #42053, which upgraded
ColorPickerControl(custom presets,resolveThemeTokens,outputFormat) and used it to fixConditionalFormattingControl. This PR finds and fixes the four remaining places in the app that still used a legacy/degraded color-selection UI instead of the shared picker, one commit per item.1. Gauge chart interval colors
Gauge/controlPanel.tsx's "Interval colors" control asked users to type comma-separated 1-indexed positions into the chosen color scheme (e.g.1,2,4), with zero visual feedback and silent discarding of malformed input.Replaced with
IntervalColorsControl: oneColorPickerControlper interval bound (parsed from the existingintervalscontrol), storing real hex colors in a newinterval_colorsfield, positionally matched to those bounds.Design decision: bounds stay owned by the existing
intervalstext control rather than being folded into the new control's own row list (which the row-list add/remove pattern in the task brief technically implied). This keeps a single source of truth for bounds and avoids needing two-way sync between two independent controls — the new control's row count simply tracks whateverintervalscurrently contains.Backward compatibility: charts saved before this control existed only have
interval_color_indices(the old index strings).getIntervalBoundsAndColorsintransformProps.tsstill resolves those indices against the categorical scheme at render time wheneverinterval_colorsis empty, so existing dashboards render identically with no migration. The control also resolves legacy indices to real colors for display the first time such a chart's panel is reopened (editor convenience only, not required for correct rendering).2. Bullet chart band colors
Bullet chart background bands were hardcoded to a 4-step theme-token ramp with no color control at all — a genuinely new feature, not a swap.
Added an optional
range_colorscontrol (BulletRangeColorsControl): oneColorPickerControlper threshold parsed from the existingrangescontrol, each starting unset ("use default") with a "Use default" link to clear a customization.transformProps.tscaptures each range's chosen color by its original (pre-sort) position inrangesbefore the existing largest-first band sort reorders them for nested drawing, so colors stay pinned to the correct threshold regardless of draw order.Backward compatible by construction:
range_colorsis optional and defaults to empty, so charts saved before this control existed have no such field and keep rendering with the exact default ramp.3. Big Number Period-over-Period comparison colors
The comparison-color control was a 2-choice
SelectControl("Green for increase, red for decrease" / reverse) bound directly totheme.colorSuccess/theme.colorError.Replaced with two
ColorPickerControls,increase_color/decrease_color, using the exactresolveThemeTokens+outputFormat="hex"pattern #42053 introduced: picking the Green/Red preset swatch stores the token name (so it still reads the same as before for users who just want the classic behavior), while any other pick stores a literal hex color. ExportedSPECIAL_COLORS/SpecialColorKeyfromColorPickerControl.tsxso this call site doesn't redefine the Green/Red mapping.The color→style resolution moved into two small, independently unit-tested pure functions in
utils.ts(resolveComparisonColorKeys,getComparisonColorTokens) rather than living inline inPopKPI's render body — jsdom doesn't reliably expose emotion's injected styles totoHaveStylefor direct component assertions, so the logic needed to be testable on its own.Backward compatibility:
resolveComparisonColorKeysfalls back to the legacycomparisonColorSchemefield (kept,@deprecatedintypes.ts) whenever the new fields are absent — including correctly reversing increase/decrease for charts saved with the old "Red for increase, green for decrease" choice, the case a naive default-to-Green migration would have silently broken.4. Admin Theme editor curated colors
ThemeModal.tsxonly exposed antd theming as a single JSON textarea, requiring admins to paste in a whole token object from an external tool to change even one color.Added a "Colors" section (
ThemeColorPickers) above the JSON textarea with oneColorPickerControlper curated antd token — the 5 SEED colors (colorPrimary,colorSuccess,colorWarning,colorError,colorInfo) plus 6 load-bearing map/alias tokens (colorLink,colorText,colorTextSecondary,colorBgBase,colorBgContainer,colorBorder). This intentionally does not attempt the full 100+ token surface — everything else stays fully editable via the JSON textarea, which remains the source of truth. Names are taken directly from antd's ownSeedToken/MapTokentypes, not invented.Sync is two-way, via two small pure functions (
tryParseThemeJson,patchThemeJsonToken):tokenobject and re-serializes with the modal's existing 2-space indent, preserving every other key (curated or not).tryParseThemeJsonreturnsnullinstead of throwing (matching the file's existingisValidJsonconvention); the section shows a small notice and pickers stop persisting edits until the JSON is valid again.The section is hidden for read-only system themes, matching the existing Format/Apply button visibility.
No backward-compat concern — additive UI over the same JSON, nothing about existing saved themes changes.
TESTING INSTRUCTIONS
npm run testinsuperset-frontend/— new/updated suites:plugins/plugin-chart-echarts/test/Gauge/transformProps.test.tssrc/explore/components/controls/IntervalColorsControl/IntervalColorsControl.test.tsxplugins/plugin-chart-echarts/test/Bullet/transformProps.test.tssrc/explore/components/controls/BulletRangeColorsControl/BulletRangeColorsControl.test.tsxplugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/{utils,PopKPI}.test.tsxsrc/features/themes/{ThemeModal,ThemeColorPickers}.test.tsxinterval_color_indicesonly, an existing Bullet chart with norange_colors, and a Big Number PoP chart saved with onlycomparison_color_scheme(including theRedvalue) — all three should render identically to before this PR.ADDITIONAL INFORMATION