diff --git a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx index e2329ac906ee..6f7fb47d8865 100644 --- a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx +++ b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx @@ -170,12 +170,21 @@ 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) { + return `${theme.colorFillSecondary}50`; + } + + if (value < 0) { + return `${theme.colorError}50`; + } + + return `${theme.colorSuccess}50`; } function SortIcon({ column }: { column: ColumnInstance }) { @@ -881,6 +890,7 @@ export default function TableChart( background-color: ${cellBackground({ value: value as number, colorPositiveNegative, + theme, })}; `} `; @@ -1089,6 +1099,7 @@ export default function TableChart( totals, columnColorFormatters, columnOrderToggle, + theme, ], );