Files
James Ritchie 4c5237ca4a feat(webapp): themes refinement, new black & white themes, 2 accessibility toggles (#4547)
## What this does

Rounds out the theme work behind the existing `hasThemeSwitcher` flag.

**Two new themes.** Black and White sit alongside Dark and Light. They
inherit their neighbour's whole token set and only pin their surfaces
flat, so sections are separated by grid lines rather than layered fills.

**`System` is now configurable at both ends.** You choose which theme
the OS light setting lands on (Light or White) and which the dark
setting lands on (Dark or Black).

**Two accessibility toggles.**
- *Stronger colors* — swaps tinted status chips for solid fills, drops
decorative icon accents to monochrome, and darkens chart series that
didn't clear 3:1 on a white plot.
- *Underline links* — underlines body-text links, so an underline always
means the preference is on rather than being a hover style.

**Contrast slider.** Stores a 0–100 position within the active theme's
own range rather than a shared scale, so 35% stays 35% when you switch
themes. Each theme maps it in CSS, which keeps `system` working before
hydration.

**Appearance in the account popover.** A submenu listing the themes with
a check against the current one, plus a link through to the full set on
your profile. Picking one applies immediately rather than waiting for
the write to round-trip.

**Profile page.** Each row now saves on its own — no submit button. Name
and email show their value inline with an edit button; the email row is
read-only when an identity provider owns the address.

**A `/storybook/colors` audit page.** Renders every colour-carrying
pattern in the app once per theme plus once under Stronger colors, and
measures contrast ratios off the live DOM rather than a hard-coded
table, so it can't go stale.

---

## Demo


https://github.com/user-attachments/assets/d56cd4d8-719f-4ec5-a990-e04cdb98def1


---


## Compatibility

The stored preference shape is unchanged (`version: "1"`), and the four
new fields are all optional. The retired `classic` theme falls back to
Dark, whose palette at contrast 0 is what Classic shipped.

One deliberate change worth knowing: the default contrast moves from 50
to 0, so existing users who never touched the slider will see slightly
less contrast than before. That's what makes 0 mean "the base palette".

---

## Testing

Switched between every theme from both the account popover and the
profile page, in the expanded and collapsed rail, checking `data-theme`
follows and survives a reload. Dragged the contrast slider in each theme
and confirmed the percentage label tracks the handle and resnaps if a
save fails. Checked both accessibility toggles across the
`/storybook/colors` page, which is also where the contrast ratios were
read from. Confirmed the Appearance entry stays hidden for a non-admin
while the flag is off.

<!-- conductor-workspace-link -->

---

[Open workspace in
Conductor](https://app.conductor.build/workspace/fee50611-7623-4422-bada-ed1cba317ed1)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 19:27:52 +01:00

48 lines
1.5 KiB
TypeScript

import { type ErrorGroupStatus } from "@trigger.dev/database";
import { cn } from "~/utils/cn";
// Two prominence levels: `subtle` keeps the tinted look for dense lists,
// `bright` fills the chip with the status color in the System themes for
// solitary placements (detail headers). Classic always uses the tinted look.
const subtleStyles: Record<ErrorGroupStatus, string> = {
UNRESOLVED: "bg-error/10 text-error",
RESOLVED: "bg-success/10 text-success",
IGNORED: "bg-blue-500/10 text-blue-400 system:text-blue-500",
};
const brightStyles: Record<ErrorGroupStatus, string> = {
UNRESOLVED: "bg-error/10 text-error system:bg-error system:text-white",
RESOLVED: "bg-success/10 text-success system:bg-success system:text-white",
IGNORED: "bg-blue-500/10 text-blue-400 system:bg-blue-500 system:text-white",
};
const labels: Record<ErrorGroupStatus, string> = {
UNRESOLVED: "Unresolved",
RESOLVED: "Resolved",
IGNORED: "Ignored",
};
export function ErrorStatusBadge({
status,
className,
prominence = "subtle",
}: {
status: ErrorGroupStatus;
className?: string;
prominence?: "subtle" | "bright";
}) {
return (
<span
className={cn(
"inline-flex items-center rounded px-2 py-0.5 text-xs font-medium",
// The contrast ring is for tints; `bright` fills solid.
prominence !== "bright" && "contrast-chip",
(prominence === "bright" ? brightStyles : subtleStyles)[status],
className
)}
>
{labels[status]}
</span>
);
}