fix(table-chart): fix cell bar visibility in dark theme (#35211)

This commit is contained in:
Levis Mbote
2025-09-23 10:06:03 +03:00
committed by GitHub
parent 48e1b1ff2c
commit ce55cc7dd7

View File

@@ -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<D extends object>({ column }: { column: ColumnInstance<D> }) {
@@ -881,6 +890,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
background-color: ${cellBackground({
value: value as number,
colorPositiveNegative,
theme,
})};
`}
`;
@@ -1089,6 +1099,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
totals,
columnColorFormatters,
columnOrderToggle,
theme,
],
);