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

(cherry picked from commit ce55cc7dd7)
This commit is contained in:
Levis Mbote
2025-09-23 10:06:03 +03:00
committed by Joe Li
parent 13b7bbe9a4
commit 1621c70b68

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> }) {
@@ -883,6 +892,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
background-color: ${cellBackground({
value: value as number,
colorPositiveNegative,
theme,
})};
`}
`;
@@ -1091,6 +1101,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
totals,
columnColorFormatters,
columnOrderToggle,
theme,
],
);