amaannawab923 commented on code in PR #35211:
URL: https://github.com/apache/superset/pull/35211#discussion_r2366179761
##########
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:
##########
@@ -170,12 +171,25 @@ function cellOffset({
function cellBackground({
value,
colorPositiveNegative = false,
+ theme,
}: {
value: number;
colorPositiveNegative: boolean;
+ theme: SupersetTheme;
}) {
- const r = colorPositiveNegative && value < 0 ? 150 : 0;
- return `rgba(${r},0,0,0.2)`;
+ if (!colorPositiveNegative) {
Review Comment:
True ... We can use these theming tokens .... only problem was the alpha
value is a bit low at anywhere between 0.04 to 0.15
function cellBackground({
value,
colorPositiveNegative = false,
theme,
}: {
value: number;
colorPositiveNegative: boolean;
theme: SupersetTheme;
}) {
if (!colorPositiveNegative) {
const fillColor = theme.colorFillSecondary;
const { r, g, b } = tinycolor(fillColor).toRgb();
return `rgba(${r},${g},${b},0.2)`;
}
if (value < 0) {
return theme.colorErrorBg;
}
const successColor = theme.colorSuccess;
const { r, g, b } = tinycolor(successColor).toRgb();
return `rgba(${r},${g},${b},0.2)`;
}
This solution works though if we can rewrite the alpha value and since this
completely depends on theming tokens we dont need to check if the theme is dark
or not
--
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]