mohammadqassim12 opened a new pull request, #36280:
URL: https://github.com/apache/superset/pull/36280

   ### 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:
   
   - **Gradient mode** (current behavior): apply a color gradient by varying 
opacity based on the metric value.
   - **Solid mode** (new behavior): render all formatted cells using the 
selected color at full opacity.
   
   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:
   - Extend `ConditionalFormattingConfig` with a `useGradient` flag.
   - Update the color computation logic (`getColorFunction`) to respect 
`useGradient` and fall back to solid colors when disabled.
   - Add a **"Use gradient"** checkbox to the `FormattingPopoverContent` UI.
   - Default `useGradient` to `true` for backward compatibility with existing 
saved charts and dashboards.
   
   ### AFTER SCREENSHOTS
   <img width="3024" height="1964" alt="image" 
src="https://github.com/user-attachments/assets/4c07d4bd-652d-4e52-9209-f30bb8afb306";
 />
   
   <img width="3024" height="1964" alt="image" 
src="https://github.com/user-attachments/assets/cf8f3c93-3da6-4405-ae99-27b3e6ba73ea";
 />
   
   ### TESTING INSTRUCTIONS
   1. **Basic UI behavior**
      1. Create or open a **Table** chart.
      2. Open the **Customize** / **Conditional formatting** panel.
      3. Confirm that a **"Use gradient"** checkbox is visible in the 
formatting popover.
      4. Ensure the checkbox is **checked by default** for:
         - Newly created conditional formatting rules.
         - Existing charts with conditional formatting.
   
   2. **Gradient mode (backward compatibility)**
      1. With **"Use gradient"** checked:
         - Apply a conditional formatting rule on a numeric column.
         - Verify that cell colors are rendered using varying opacity (gradient 
behavior).
         - Confirm that existing dashboards continue to look the same as before.
   
   3. **Solid mode behavior**
      1. Uncheck **"Use gradient"** for a conditional formatting rule.
      2. Apply the rule and run the query.
      3. Verify that formatted cells are rendered with **solid colors** (full 
opacity).
      4. Toggle the checkbox on/off and confirm the visual changes update 
accordingly.
   
   Automated Tests: 
   - `cd superset-frontend && npm run test`
   - Run specific unit tests added in this pr: 
   `npm run test -- getColorFormatters && npm run test -- TableChart && npm run 
test -- FormattingPopoverContent `
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to