rusackas commented on code in PR #42910:
URL: https://github.com/apache/superset/pull/42910#discussion_r4366676709
##########
superset-frontend/src/explore/components/controls/ColorPickerControl.tsx:
##########
@@ -193,10 +234,12 @@ export default function ColorPickerControl({
const rgb = color.toRgb();
const hex = rgbaToHex(rgb).toLowerCase();
+ // Match against the same hex the preset chip and trigger display, so a
+ // special color picked from a theme-resolved chip maps back to its key.
const specialEntry = resolveThemeTokens
- ? Object.entries(SPECIAL_COLORS).find(
- ([, rgba]) => rgbaToHex(rgba).toLowerCase() === hex,
- )
+ ? Object.keys(SPECIAL_COLORS)
+ .map(key => [key, toDisplayHex(key, themeColors, true)] as const)
+ .find(([, displayHex]) => displayHex === hex)
Review Comment:
Good catch @sadpandajoe. The Green/Red match now only considers keys
actually present in the supplied presets, so the plain `colorSuccess` swatch
falls through to the theme-token lookup. Added a component test pinning
`onChange('colorSuccess')` with no trend presets.
--
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]