From 1621c70b68842e57b847eaac64144ae13d0ce9b2 Mon Sep 17 00:00:00 2001 From: Levis Mbote <111055098+LevisNgigi@users.noreply.github.com> Date: Tue, 23 Sep 2025 10:06:03 +0300 Subject: [PATCH] fix(table-chart): fix cell bar visibility in dark theme (#35211) (cherry picked from commit ce55cc7dd7aaa28d6555c97cedf59cec07c74947) --- .../plugins/plugin-chart-table/src/TableChart.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx index 53b56d59292..1094f05eee0 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 }) { @@ -883,6 +892,7 @@ export default function TableChart( background-color: ${cellBackground({ value: value as number, colorPositiveNegative, + theme, })}; `} `; @@ -1091,6 +1101,7 @@ export default function TableChart( totals, columnColorFormatters, columnOrderToggle, + theme, ], );