dosubot[bot] commented on issue #36875: URL: https://github.com/apache/superset/issues/36875#issuecomment-3701467301
<!-- Greeting --> Hi @parag2131! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> This is a confirmed gap in Superset: conditional formatting in Big Number and similar charts does not use the UI theme tokens colorSuccess, colorWarning, or colorError. Instead, it uses preset colors that are not linked to your theme settings, so updating THEME_DEFAULT with those tokens has no effect on conditional formatting colors in charts. Currently, the only way to globally change the conditional formatting colors for "success", "warning", and "error" in these charts is to override the tokens colorSuccessBg, colorWarningBg, and colorErrorBg in your THEME_DEFAULT config. For example: ```python THEME_DEFAULT = { "token": { "colorSuccessBg": "#52c41a", "colorWarningBg": "#faad14", "colorErrorBg": "#ff4d4f", } } ``` This will update the preset colors used in the conditional formatting dialog, but it also affects all other places in Superset that use these background tokens. There is no way to set these colors just for Big Number or to use the text tokens (colorSuccess, colorWarning, colorError) without a code change. The UI does not allow picking custom colors or entering hex codes for conditional formatting—only the three preset theme colors are available, and those are controlled by the Bg tokens, not the text tokens you expected. [See discussion and code references](https://github.com/apache/superset/discussions/35056). The technical reason is that the chart's conditional formatting logic (via colorThresholdFormatters) does not reference the theme tokens for text colors, only the preset palette or Bg tokens. To make conditional formatting respect colorSuccess, colorWarning, and colorError, the formatter logic would need to be updated to pull those values from the live theme context when applying success/warning/error formats. This would require changes in the Big Number chart plugin and the formatter construction logic [see code](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx#L208-L586). There is also a known limitation: if you use the Theme Editor or switch themes in the UI, Superset will use the theme stored in your browser's localStorage, which overrides the backend THEME_DEFAULT config until you clear localStorage. This can make theme changes appear inconsistent if you are testing different approaches [see explanation](https://github.com/apache/superset/issues/33930). If you want to contribute a fix or need pointers to the relevant files for updating the formatter logic to use the text tokens, let me know! <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/2b37c8ad-0a57-4df3-9d53-f8a6fd9bbee3?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/2b37c8ad-0a57-4df3-9d53-f8a6fd9bbee3?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/2b37c8ad-0a57-4df3-9d53-f8a6fd9bbee3?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/2b37c8ad-0a57-4df3-9d53-f8a6fd9bbee3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/2b37c8ad-0a57-4df3-9d53-f8a6fd9bbee3?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/2b37c8ad-0a57-4df3-9d53-f8a6fd9bbee3?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/2b37c8ad-0a57-4df3-9d53-f8a6fd9bbee3?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20is%20a%20confirmed%20gap%20in%20Superset%3A%20conditional%20formatting%20in%20Big%20Number%20and%20similar%20charts%20does%20not%20use%20the%20UI%20theme%20tokens%20colorSuccess%2C%20colorWarning%2C%20or%20colorError.%20Instead%2C%20it%20uses%20preset%20colors%20that%20are%20not%20linked%20to%20your%20theme%20settings%2C%20so%20updating%20THEME_DEFAULT%20with%20those%20tokens%20has%20no%20effect%20on%20conditional%20formatting%20colors%20in%20charts.%0A%0ACurrently%2C%20the%20only%20way%20to%20globally%20change%20the%20conditional%20formatting%20colors%20for%20%22success%22%2C%20%22warning%22%2C%20and%20%22error%22%20in%20these%20charts%20is%20to%20override%20the%20tokens%20colorSuccessBg%2C%20colorWarningBg%2C%20and%20colorErrorBg%20in%20yo ur%20THEME_DEFAULT%20config.%20For%20example%3A%0A%0A%60%60%60python%0ATHEME_DEFAULT%20%3D%20%7B%0A%20%20%20%20%22token%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22colorSuccessBg%22%3A%20%22%2352c41a%22%2C%0A%20%20%20%20%20%20%20%20%22colorWarningBg%22%3A%20%22%23faad14%22%2C%0A%20%20%20%20%20%20%20%20%22colorErrorBg%22%3A%20%22%23ff4d4f%22%2C%0A%20%20%20%20%7D%0A%7D%0A%60%60%60%0A%0AThis%20will%20update%20the%20preset%20colors%20used%20in%20the%20conditional%20formatting%20dialog%2C%20but%20it%20also%20affects%20all%20other%20places%20in%20Superset%20that%20use%20these%20background%20tokens.%20There%20is%20no%20way%20to%20set%20these%20colors%20just%20for%20Big%20Number%20or%20to%20use%20the%20text%20tokens%20%28colorSuccess%2C%20colorWarning%2C%20colorError%29%20without%20a%20code%20change.%20The%20UI%20does%20not%20allow%20picking%20custom%20colors%20or%20entering%20hex%20codes%20for%20conditional%20formatting%E2%80%94only%20the%20three%20preset%20theme%20colors%20are%20available%2C %20and%20those%20are%20controlled%20by%20the%20Bg%20tokens%2C%20not%20the%20text%20tokens%20you%20expected.%20%5BSee%20discussion%20and%20code%20references%5D%28https%3A//github.com/apache/superset/discussions/35056%29.%0A%0AThe%20technical%20reason%20is%20that%20the%20chart%27s%20conditional%20formatting%20logic%20%28via%20colorThresholdFormatters%29%20does%20not%20reference%20the%20theme%20tokens%20for%20text%20colors%2C%20only%20the%20preset%20palette%20or%20Bg%20tokens.%20To%20make%20conditional%20formatting%20respect%20colorSuccess%2C%20colorWarning%2C%20and%20colorError%2C%20the%20formatter%20logic%20would%20need%20to%20be%20updated%20to%20pull%20those%20values%20from%20the%20live%20theme%20context%20when%20applying%20success/warning/error%20formats.%20This%20would%20require%20changes%20in%20the%20Big%20Number%20chart%20plugin%20and%20the%20formatter%20construction%20logic%20%5Bsee%20code%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/s uperset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx%23L208-L586%29.%0A%0AThere%20is%20also%20a%20known%20limitation%3A%20if%20you%20use%20the%20Theme%20Editor%20or%20switch%20themes%20in%20the%20UI%2C%20Superset%20will%20use%20the%20theme%20stored%20in%20your%20browser%27s%20localStorage%2C%20which%20overrides%20the%20backend%20THEME_DEFAULT%20config%20until%20you%20clear%20localStorage.%20This%20can%20make%20theme%20changes%20appear%20inconsistent%20if%20you%20are%20testing%20different%20approaches%20%5Bsee%20explanation%5D%28https%3A//github.com/apache/superset/issues/33930%29.%0A%0AIf%20you%20want%20to%20contribute%20a%20fix%20or%20need%20pointers%20to%20the%20relevant%20files%20for%20updating%20the%20formatter%20logic%20to%20use%20the%20text%20tokens%2C%20let%20me%20know%21) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36875) -- 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]
