mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 21:10:59 +00:00
style(insights): move mood colored text onto semantic feedback tokens
The mood confidence chips, the better-days / influence / crosstab delta read-outs, and the mood-chart comparison caption coloured their TEXT with raw `--dracula-*` values. Those stay bright green/cyan/red/purple in light mode (Alucard) and fail WCAG AA on the white card. Swap the coloured-text surfaces to the semantic feedback tokens (`--success` / `--info` / `--destructive`) and the theme-aware `dose-accent` purple, which carry the light-mode overrides that clear AA in both themes. Decorative chart fills, strokes, heatmap cells, and legend swatches keep their `--dracula-*` tokens — those are non-text and already token-based. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3cd04533be
commit
56934fd658
4 files changed
+32
-12
No files matched your search
@@ -632,7 +632,7 @@ export function MoodChart({
|
||||
effectiveCompareBaseline !== "none" &&
|
||||
hasComparisonData && (
|
||||
<span
|
||||
className="text-dracula-purple bg-dracula-purple/10 hidden rounded-md border border-current/30 px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase sm:inline-flex"
|
||||
className="text-dose-accent bg-dose-accent/10 hidden rounded-md border border-current/30 px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase sm:inline-flex"
|
||||
data-slot="chart-compare-caption"
|
||||
>
|
||||
{t(
|
||||
|
||||
@@ -47,10 +47,14 @@ const CONFIDENCE_KEY: Record<MoodInfluenceConfidence, string> = {
|
||||
high: "insights.mood.influence.confidenceHigh",
|
||||
};
|
||||
|
||||
// Confidence chips carry COLORED TEXT, so they ride the semantic feedback
|
||||
// tokens (`--info` / `--success`) — these carry the Alucard light-mode
|
||||
// overrides that clear AA on the white card. Raw `--dracula-*` stays bright
|
||||
// green/cyan in light mode and fails AA for text.
|
||||
const CONFIDENCE_CLASS: Record<MoodInfluenceConfidence, string> = {
|
||||
low: "bg-secondary text-muted-foreground",
|
||||
medium: "bg-[color:var(--dracula-cyan)]/15 text-[color:var(--dracula-cyan)]",
|
||||
high: "bg-[color:var(--dracula-green)]/15 text-[color:var(--dracula-green)]",
|
||||
medium: "bg-info/15 text-info",
|
||||
high: "bg-success/15 text-success",
|
||||
};
|
||||
|
||||
export function MoodBetterDays({
|
||||
@@ -82,9 +86,13 @@ export function MoodBetterDays({
|
||||
}
|
||||
|
||||
const DirectionIcon = up ? ArrowUpRight : ArrowDownRight;
|
||||
// Semantic feedback tokens (not raw `--dracula-*`): the effect
|
||||
// read-out is COLORED TEXT, so it needs the Alucard light-mode
|
||||
// override to clear AA. The arrow icon shares the same token so the
|
||||
// good→down ramp stays coherent across both themes.
|
||||
const directionColor = up
|
||||
? "var(--dracula-green)"
|
||||
: "var(--dracula-red)";
|
||||
? "var(--success)"
|
||||
: "var(--destructive)";
|
||||
|
||||
// The effect read-out: tag factors show the mood-point delta,
|
||||
// metric factors show the correlation coefficient.
|
||||
|
||||
@@ -38,14 +38,20 @@ const CONFIDENCE_KEY: Record<MoodInfluenceConfidence, string> = {
|
||||
high: "insights.mood.influence.confidenceHigh",
|
||||
};
|
||||
|
||||
// Confidence chips carry COLORED TEXT, so they ride the semantic feedback
|
||||
// tokens (`--info` / `--success`) — these carry the Alucard light-mode
|
||||
// overrides that clear AA on the white card. Raw `--dracula-*` stays bright
|
||||
// green/cyan in light mode and fails AA for text.
|
||||
const CONFIDENCE_CLASS: Record<MoodInfluenceConfidence, string> = {
|
||||
low: "bg-secondary text-muted-foreground",
|
||||
medium: "bg-[color:var(--dracula-cyan)]/15 text-[color:var(--dracula-cyan)]",
|
||||
high: "bg-[color:var(--dracula-green)]/15 text-[color:var(--dracula-green)]",
|
||||
medium: "bg-info/15 text-info",
|
||||
high: "bg-success/15 text-success",
|
||||
};
|
||||
|
||||
// Semantic feedback tokens (not raw `--dracula-*`): the delta read-out is
|
||||
// COLORED TEXT, so it needs the Alucard light-mode override to clear AA.
|
||||
function deltaColor(delta: number): string {
|
||||
return delta >= 0 ? "var(--dracula-green)" : "var(--dracula-red)";
|
||||
return delta >= 0 ? "var(--success)" : "var(--destructive)";
|
||||
}
|
||||
|
||||
export function MoodTagInfluence({
|
||||
|
||||
@@ -57,10 +57,14 @@ const CONFIDENCE_KEY: Record<MoodInfluenceConfidence, string> = {
|
||||
high: "insights.mood.influence.confidenceHigh",
|
||||
};
|
||||
|
||||
// Confidence chips carry COLORED TEXT, so they ride the semantic feedback
|
||||
// tokens (`--info` / `--success`) — these carry the Alucard light-mode
|
||||
// overrides that clear AA on the white card. Raw `--dracula-*` stays bright
|
||||
// green/cyan in light mode and fails AA for text.
|
||||
const CONFIDENCE_CLASS: Record<MoodInfluenceConfidence, string> = {
|
||||
low: "bg-secondary text-muted-foreground",
|
||||
medium: "bg-[color:var(--dracula-cyan)]/15 text-[color:var(--dracula-cyan)]",
|
||||
high: "bg-[color:var(--dracula-green)]/15 text-[color:var(--dracula-green)]",
|
||||
medium: "bg-info/15 text-info",
|
||||
high: "bg-success/15 text-success",
|
||||
};
|
||||
|
||||
/** One decimal for hours/score, whole numbers for kcal. */
|
||||
@@ -91,9 +95,11 @@ export function MoodTagMetricCrosstab({
|
||||
const unit = t(UNIT_KEY[row.display]);
|
||||
const up = row.delta >= 0;
|
||||
const deltaText = `${up ? "+" : ""}${fmt(row.delta, row.display)} ${unit}`;
|
||||
// Semantic feedback tokens (not raw `--dracula-*`): the delta read-out
|
||||
// is COLORED TEXT, so it needs the Alucard light-mode override for AA.
|
||||
const deltaColor = up
|
||||
? "var(--dracula-green)"
|
||||
: "var(--dracula-red)";
|
||||
? "var(--success)"
|
||||
: "var(--destructive)";
|
||||
return (
|
||||
<li
|
||||
key={`${row.metricKey}:${row.tag}`}
|
||||
|
||||
Reference in new issue
Block a user