From 76154b5752fd8c1510ba77d7ad61bb642c2024e5 Mon Sep 17 00:00:00 2001 From: Kyle Grieder Date: Sun, 12 Apr 2026 13:30:28 -0600 Subject: [PATCH] fix: use computed color scheme in system resources charts useMantineColorScheme() returns 'auto' when system mode is active, causing the chart background color to fall through to the light variant. Switch to useComputedColorScheme() which always resolves to the actual 'light' or 'dark' value, keeping charts visually correct in all modes. --- .../widgets/src/system-resources/chart/common-chart.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/widgets/src/system-resources/chart/common-chart.tsx b/packages/widgets/src/system-resources/chart/common-chart.tsx index f7cc57c27..2c25c8218 100644 --- a/packages/widgets/src/system-resources/chart/common-chart.tsx +++ b/packages/widgets/src/system-resources/chart/common-chart.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from "react"; import type { AreaChartSeries } from "@mantine/charts"; import { AreaChart, LineChart } from "@mantine/charts"; -import { Card, Center, Group, Loader, Stack, Text, useMantineColorScheme, useMantineTheme } from "@mantine/core"; +import { Card, Center, Group, Loader, Stack, Text, useComputedColorScheme, useMantineTheme } from "@mantine/core"; import { useElementSize, useHover, useMergedRef } from "@mantine/hooks"; import type { TooltipProps, YAxisProps } from "recharts"; @@ -36,14 +36,13 @@ export const CommonChart = ({ }) => { const { ref: elementSizeRef, height } = useElementSize(); const theme = useMantineTheme(); - const scheme = useMantineColorScheme(); + const colorScheme = useComputedColorScheme("light"); const board = useRequiredBoard(); const { hovered, ref: hoverRef } = useHover(); const ref = useMergedRef(elementSizeRef, hoverRef); const opacity = board.opacity / 100; - const backgroundColor = - scheme.colorScheme === "dark" ? `rgba(57, 57, 57, ${opacity})` : `rgba(246, 247, 248, ${opacity})`; + const backgroundColor = colorScheme === "dark" ? `rgba(57, 57, 57, ${opacity})` : `rgba(246, 247, 248, ${opacity})`; const ChartComponent = chartType === "line" ? LineChart : AreaChart; const showIcon = labelDisplayMode === "icon" || labelDisplayMode === "textWithIcon";