-
Notifications
You must be signed in to change notification settings - Fork 16.3k
feat(table): Gradient Toggle #36280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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