feat(table): Gradient Toggle#36280
Conversation
Add a "Use gradient" checkbox to conditional formatting that allows users to switch between gradient colors (varying opacity) and solid colors (full opacity). Changes: - Add useGradient flag to ConditionalFormattingConfig type - Modify getColorFunction to support solid color mode when useGradient is false - Add "Use gradient" checkbox to FormattingPopoverContent UI - Default to checked (true) for backward compatibility with existing configs
There was a problem hiding this comment.
Pull request overview
This PR introduces a "Use gradient" toggle for conditional formatting in table charts, giving users explicit control over whether colored cells use gradient opacity effects or solid colors.
Key changes:
- Adds a
useGradientboolean flag toConditionalFormattingConfigtype definitions - Updates color computation logic to respect the flag, returning solid colors when disabled or gradient colors (with opacity) when enabled
- Implements a new checkbox in the formatting UI that defaults to checked for backward compatibility
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
superset-frontend/src/explore/components/controls/ConditionalFormattingControl/types.ts |
Adds useGradient?: boolean to ConditionalFormattingConfig type |
superset-frontend/packages/superset-ui-chart-controls/src/types.ts |
Adds useGradient?: boolean to ConditionalFormattingConfig type for consistency |
superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx |
Implements "Use gradient" checkbox with proper state management and form integration |
superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts |
Updates color function to check useGradient flag and return solid colors when false |
superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.test.tsx |
Adds tests verifying checkbox display, default state, and toggle behavior |
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx |
Adds comprehensive tests for gradient vs solid color rendering with various operators |
superset-frontend/packages/superset-ui-chart-controls/test/utils/getColorFormatters.test.ts |
Adds unit tests for color function with useGradient flag, including backward compatibility |
|
Running CI 🤞 |
|
Fixed the failing pre-commit check (missing newline at end of file). CI should pass now. |
|
@SBIN2010 CI is passing now... how's it look to you? |
|
Thanks for the PR @mohammadqassim12 and thanks for the review @SBIN2010 - but it seems we have a conflict to contend with. @mohammadqassim12 would you mind rebasing the PR or addressing/resolving the conflict? Then I think we can merge this one :D |
|
CodeAnt AI is reviewing your PR. |
|
CodeAnt AI finished reviewing your PR. |
|
Oh my, new conflicts have arisen! I'll try again to merge once that's sorted out. Thanks for sticking with it :D |
Merged upstream/master into feature/gradient-toggle branch and resolved conflict in getColorFormatters.test.ts by keeping both: - Gradient toggle tests (useGradient feature) - Boolean comparator tests (IsTrue, IsFalse, IsNull, IsNotNull) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
CodeAnt AI is running Incremental review |
|
Hey @rusackas , I went ahead and resolved the merge conflicts as soon as i got the notification. The branch should be good to go! |
|
Running CI 🤞 |
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
- theming.mdx: document ECharts array property overrides (PR #37965) — array values like color palettes are fully supported and replaced entirely (not merged); adds Array Property Overrides section with color palette example - configuring-superset.mdx: document PKCE support for database OAuth2 (PR #37067) — add PKCE section under Custom OAuth2 with code_challenge_method config and when to use it - cache.mdx: document ETag support for thumbnail/screenshot endpoints (PR #37663) — conditional GET with If-None-Match to avoid downloading unchanged images - exploring-data.mdx: document SQL Lab UX improvements (PRs #37298, #37694, #37756) — treeview table browser, Ctrl+F find widget, resizable panels; also adds time range natural language expressions section (PR #37098) - creating-your-first-dashboard.mdx: document Table chart features — boolean and categorical conditional formatting (PRs #36338, #37756), gradient toggle (PR #36280), HTML cell rendering with security note (PR #37685), column header tooltips from dataset descriptions (PR #37179), Display Controls modal in dashboard view (PR #36062) - databases.json: update StarRocks supports_catalog and supports_dynamic_catalog to true — the engine spec (PR #37026) already implemented full catalog support with get_catalog_names(), get_default_catalog(), and SHOW CATALOGS; the committed JSON was stale and did not reflect this Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
User description
SUMMARY
This PR adds a "Use gradient" toggle to the table chart’s conditional formatting configuration.
Previously, conditional formatting always rendered colors using a gradient (via varying opacity). With this change, users can explicitly choose between:
This gives users finer control over the visual styling of conditional formatting, especially in cases where gradients can be visually noisy or conflict with existing themes.
Key changes:
ConditionalFormattingConfigwith auseGradientflag.getColorFunction) to respectuseGradientand fall back to solid colors when disabled.FormattingPopoverContentUI.useGradienttotruefor backward compatibility with existing saved charts and dashboards.AFTER SCREENSHOTS
TESTING INSTRUCTIONS
Basic UI behavior
Gradient mode (backward compatibility)
Solid mode behavior
Automated Tests:
cd superset-frontend && npm run testnpm run test -- getColorFormatters && npm run test -- TableChart && npm run test -- FormattingPopoverContentADDITIONAL INFORMATION
CodeAnt-AI Description
Let table conditional formatting switch between solid and gradient colors
What Changed
Impact
✅ Less visually noisy table highlighting✅ More control over conditional formatting appearance✅ Backward-compatible table styling behavior💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.