Skip to content

Commit ce55cc7

Browse files
authored
fix(table-chart): fix cell bar visibility in dark theme (#35211)
1 parent 48e1b1f commit ce55cc7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,21 @@ function cellOffset({
170170
function cellBackground({
171171
value,
172172
colorPositiveNegative = false,
173+
theme,
173174
}: {
174175
value: number;
175176
colorPositiveNegative: boolean;
177+
theme: SupersetTheme;
176178
}) {
177-
const r = colorPositiveNegative && value < 0 ? 150 : 0;
178-
return `rgba(${r},0,0,0.2)`;
179+
if (!colorPositiveNegative) {
180+
return `${theme.colorFillSecondary}50`;
181+
}
182+
183+
if (value < 0) {
184+
return `${theme.colorError}50`;
185+
}
186+
187+
return `${theme.colorSuccess}50`;
179188
}
180189

181190
function SortIcon<D extends object>({ column }: { column: ColumnInstance<D> }) {
@@ -881,6 +890,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
881890
background-color: ${cellBackground({
882891
value: value as number,
883892
colorPositiveNegative,
893+
theme,
884894
})};
885895
`}
886896
`;
@@ -1089,6 +1099,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
10891099
totals,
10901100
columnColorFormatters,
10911101
columnOrderToggle,
1102+
theme,
10921103
],
10931104
);
10941105

0 commit comments

Comments
 (0)