fix: 优化亮暗模式下文本可读性

This commit is contained in:
Montia37
2025-09-08 18:18:44 +08:00
parent 4d4da8d3b8
commit b1405376a0
5 changed files with 25 additions and 14 deletions

View File

@@ -54,10 +54,7 @@ function ChartContainer({
<div
data-slot="chart"
data-chart={chartId}
className={cn(
"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
className
)}
className={cn("flex justify-center text-xs", className)}
style={{ position: "relative", overflow: "hidden" }}
{...props}>
<ChartStyle id={chartId} config={config} />

View File

@@ -14,7 +14,7 @@ interface TipsProps {
const Tips: React.FC<TipsProps & React.HTMLAttributes<HTMLDivElement>> = ({
size = "16",
color = "gray",
color = "var(--theme-text-muted-color)",
trigger,
children,
side = "bottom",
@@ -68,13 +68,15 @@ const Tips: React.FC<TipsProps & React.HTMLAttributes<HTMLDivElement>> = ({
sideOffset={5}
onMouseEnter={!isMobile ? () => setIsOpen(true) : undefined}
onMouseLeave={!isMobile ? () => setIsOpen(false) : undefined}
className="purcarte-blur theme-card-style z-50 text-muted-foreground"
className="purcarte-blur theme-card-style z-50"
style={{
minWidth: isMobile ? "12rem" : "16rem",
maxWidth: isMobile ? "80vw" : "16rem",
backgroundColor: "var(--card)",
}}>
<div className="relative text-sm">{children}</div>
<div className="relative text-sm text-secondary-foreground">
{children}
</div>
</Popover.Content>
</Popover.Root>
)}

View File

@@ -130,8 +130,12 @@
}
@layer utilities {
.dark .radix-themes {
--theme-text-muted-color: rgb(from var(--accent-4) r g b / 0.8);
}
.radix-themes {
--theme-text-muted-color: rgb(from var(--accent-4) r g b / 0.7);
--theme-text-muted-color: rgb(from var(--accent-12) r g b / 0.8);
}
.theme-text-shadow {
@@ -143,7 +147,7 @@
}
.theme-text-muted {
@apply text-(--theme-text-muted-color) text-shadow-sm text-shadow-(color:--accent-foreground)/20;
@apply text-(--theme-text-muted-color);
}
}

View File

@@ -260,15 +260,19 @@ const LoadCharts = memo(({ node, hours, liveData }: LoadChartsProps) => {
data={config.data}
margin={chartMargin}
{...chartProps}>
<CartesianGrid strokeDasharray="2 4" vertical={false} />
<CartesianGrid
strokeDasharray="2 4"
stroke="var(--muted-foreground)"
vertical={false}
/>
<XAxis
dataKey="time"
tickLine={false}
axisLine={{
stroke: "var(--theme-text-muted-color) !important",
stroke: "var(--theme-text-muted-color)",
}}
tick={{
fill: "var(--theme-text-muted-color) !important",
fill: "var(--theme-text-muted-color)",
}}
tickFormatter={timeFormatter}
interval={0}
@@ -283,7 +287,7 @@ const LoadCharts = memo(({ node, hours, liveData }: LoadChartsProps) => {
type="number"
tick={{
dx: -8,
fill: "var(--theme-text-muted-color) !important",
fill: "var(--theme-text-muted-color)",
}}
width={200}
mirror={true}

View File

@@ -335,7 +335,11 @@ const PingChart = memo(({ node, hours }: PingChartProps) => {
{pingHistory?.tasks && pingHistory.tasks.length > 0 ? (
<ResponsiveContainer width="100%" height={400}>
<LineChart data={chartData} margin={chartMargin}>
<CartesianGrid strokeDasharray="2 4" vertical={false} />
<CartesianGrid
strokeDasharray="2 4"
stroke="var(--muted-foreground)"
vertical={false}
/>
<XAxis
type="number"
dataKey="time"