svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_p:not(:last-child)]:mb-4",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+/** What the alert asks for, on its right: a button or two. */
+function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+
+ );
+}
+
+export { Alert, AlertAction, AlertDescription, AlertTitle };
diff --git a/app/src/components/ui/badge.tsx b/app/src/components/ui/badge.tsx
index ec6f5fa28d..fa836bcb7b 100644
--- a/app/src/components/ui/badge.tsx
+++ b/app/src/components/ui/badge.tsx
@@ -5,29 +5,46 @@ import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
/*
- * shadcn's Badge, in its Base UI flavor. Two edits, both to the look (docs/app-guidelines.md):
- * the corner is `rounded-full`, the step for round things, where shadcn writes `rounded-4xl`; and
- * the `dark:` overrides are gone, since every token already carries its dark value.
+ * shadcn's Badge, in its Base UI flavor. Three edits, all to the look (docs/app-guidelines.md):
+ * the corner is `rounded-full`, the step for round things, where shadcn writes `rounded-4xl`; the
+ * `dark:` overrides are gone, since every token already carries its dark value; and keyboard focus
+ * is the button's solid ring, with no halo over it.
*
- * `muted` and `warning` are ours, beside shadcn's variants and never in place of one: `muted` for a
- * quiet state ("Paused"), `warning` for one that wants a look ("needs review").
+ * `muted`, `success`, `warning` and `in-progress` are ours, beside shadcn's variants and never in
+ * place of one: `muted` for a quiet state ("Paused"), `success` for what worked or is working
+ * ("Connected"), `warning` for one that wants a look ("Needs review"), `in-progress` for one still
+ * going.
+ *
+ * A STATUS IS ITS COLOR'S WORDS ON ITS 10% TINT, as the design's kit draws every badge, in 12px
+ * regular words. tokens/tests/contrast.test.ts holds each status's words at 4.5:1 on its tint over
+ * the page, a card, a menu, a muted row and the sidebar, in light and dark; light `warning` is the
+ * kit's warning/25 so that it does on a muted row.
+ *
+ * A CHIP IS THE SAME BADGE, rendered as a link or a button (`render`). Only then does the pointer
+ * change it, its tint deepening to 12% as the design's chip does, and only then can the keyboard
+ * reach it. Disabled is half strength.
*/
const badgeVariants = cva(
- "inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3!",
+ "inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-normal whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive [&>svg]:pointer-events-none [&>svg]:size-3!",
{
variants: {
variant: {
- default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
+ default:
+ "bg-primary text-primary-foreground [a,button]:hover:bg-primary/80",
secondary:
- "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
+ "bg-secondary text-secondary-foreground [a,button]:hover:bg-secondary/80",
destructive:
- "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 [a]:hover:bg-destructive/20",
+ "bg-destructive/10 text-destructive [a,button]:hover:bg-destructive/12",
outline:
- "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
- ghost: "hover:bg-muted hover:text-muted-foreground",
- link: "text-primary underline-offset-4 hover:underline",
+ "border-border text-foreground [a,button]:hover:bg-muted [a,button]:hover:text-muted-foreground",
+ ghost:
+ "[a,button]:hover:bg-muted [a,button]:hover:text-muted-foreground",
+ link: "text-primary underline-offset-4 [a,button]:hover:underline",
muted: "bg-muted text-muted-foreground",
- warning: "bg-warning/10 text-warning",
+ success: "bg-success/10 text-success [a,button]:hover:bg-success/12",
+ warning: "bg-warning/10 text-warning [a,button]:hover:bg-warning/12",
+ "in-progress":
+ "bg-in-progress/10 text-in-progress [a,button]:hover:bg-in-progress/12",
},
},
defaultVariants: {
diff --git a/app/src/components/ui/bubble.tsx b/app/src/components/ui/bubble.tsx
index bae103b339..adfd31cf8c 100644
--- a/app/src/components/ui/bubble.tsx
+++ b/app/src/components/ui/bubble.tsx
@@ -72,7 +72,7 @@ function BubbleContent({
props: mergeProps<"div">(
{
className: cn(
- "w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",
+ "w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring",
className,
),
},
diff --git a/app/src/components/ui/checkbox.tsx b/app/src/components/ui/checkbox.tsx
index 699acdf8a7..de64990e76 100644
--- a/app/src/components/ui/checkbox.tsx
+++ b/app/src/components/ui/checkbox.tsx
@@ -10,13 +10,25 @@ import { cn } from "@/lib/utils";
* 1.4.11 asks for 3:1 between a control and what is beside it; `muted-foreground` is the app's
* secondary text, at 4.5:1 or more on every surface in every skin. Ticked, focused and invalid keep
* their own edges. app/tests/checkbox-contrast.test.tsx measures what the browser paints.
+ *
+ * PARTLY TICKED (`indeterminate`) is filled as a ticked box is, with a dash for the tick.
+ *
+ * UNDER THE POINTER an empty box's edge turns `foreground`, and a ticked one's fill eases to
+ * `primary/80`, as the button's does. An invalid box keeps its `destructive` edge.
+ *
+ * KEYBOARD FOCUS IS THE BUTTON'S SOLID RING: the edge turns `ring`, ticked or not, and 3px more of
+ * it are drawn outside, 4px in all. AN INVALID BOX IS RED, as the design draws it: filled with
+ * `destructive/10` under a `destructive` edge, and ticked or partly ticked it is filled with
+ * `destructive`, as a chosen radio's dot turns `destructive`. It keeps that edge under the focus
+ * ring and doesn't change under the pointer. No halo hides the ring. Disabled is half strength.
+ * Flat, as the radio is: no shadow.
*/
function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
return (
-
+
+
);
diff --git a/app/src/components/ui/item.tsx b/app/src/components/ui/item.tsx
index c8cab047dc..1073d6b66a 100644
--- a/app/src/components/ui/item.tsx
+++ b/app/src/components/ui/item.tsx
@@ -33,8 +33,14 @@ function ItemSeparator({
);
}
+/*
+ * A row that opens something, rendered as a link or a button, takes `muted` under the pointer, as the
+ * design's card does; a row that only shows something doesn't. Keyboard focus is the button's solid
+ * ring. A screen that draws its own hover on such a row names the same `[a,button]:hover:` so it
+ * replaces this one: a plain `hover:` loses to it.
+ */
const itemVariants = cva(
- "group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [a]:transition-colors [a]:hover:bg-muted",
+ "group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [a,button]:hover:bg-muted",
{
variants: {
variant: {
diff --git a/app/src/components/ui/questionnaire.tsx b/app/src/components/ui/questionnaire.tsx
index d184babc09..2145e173b6 100644
--- a/app/src/components/ui/questionnaire.tsx
+++ b/app/src/components/ui/questionnaire.tsx
@@ -103,7 +103,7 @@ function QuestionnaireChoice({
input:focus-visible]:border-ring has-[>input:focus-visible]:ring-3 has-[>input:focus-visible]:ring-ring/50 data-invalid:border-destructive data-checked:border-primary/40 data-checked:bg-muted",
+ "group/questionnaire-choice relative flex min-h-11 cursor-pointer items-start gap-2.5 rounded-lg border border-input bg-transparent px-3 py-2.5 text-start text-sm transition-colors outline-none select-none hover:bg-muted/50 has-[>input:focus-visible]:border-ring has-[>input:focus-visible]:ring-3 has-[>input:focus-visible]:ring-ring data-invalid:border-destructive data-checked:border-primary/40 data-checked:bg-muted",
"data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50",
className,
)}
@@ -166,7 +166,7 @@ function QuestionnaireInput({
+ );
+}
+
+/*
+ * shadcn's radio group (Base UI), drawn as the checkbox beside it is drawn.
+ *
+ * THE EDGE IS `muted-foreground`, not shadcn's `input`. A radio nobody has chosen is nothing but
+ * its edge, and `input` is the faint line of a field, about 1.25:1 against a card in light and
+ * 1.38:1 in dark; WCAG 2.2's 1.4.11 asks for 3:1. The checkbox's edge is `muted-foreground` for
+ * the same reason (app/tests/checkbox-contrast.test.tsx).
+ *
+ * A CHOSEN RADIO IS A RING WITH A DOT: the edge turns `primary` and a `primary` dot sits on what
+ * the radio stands on, so it never reads as a ticked checkbox.
+ *
+ * KEYBOARD FOCUS IS THE BUTTON'S SOLID RING: the edge turns `ring`, chosen or not, and 3px more of
+ * it are drawn outside, 4px in all. AN INVALID RADIO IS RED, as the design draws it: filled with
+ * `destructive/10` under a `destructive` edge, and once chosen its dot is `destructive` too. It
+ * keeps that edge under the focus ring; no halo hides the ring. Disabled is half strength, and
+ * there is no shadow.
+ *
+ * UNDER THE POINTER, as the checkbox: an empty radio's edge turns `foreground`, and a chosen one's
+ * edge and dot ease to `primary/80`. An invalid radio stays as it is.
+ */
+function RadioGroupItem({ className, ...props }: RadioPrimitive.Root.Props) {
+ return (
+
+
+
+ );
+}
+
+export { RadioGroup, RadioGroupItem };
diff --git a/app/src/components/ui/switch.tsx b/app/src/components/ui/switch.tsx
index 506bfa3c6f..ef962e38ea 100644
--- a/app/src/components/ui/switch.tsx
+++ b/app/src/components/ui/switch.tsx
@@ -14,7 +14,7 @@ function Switch({
data-slot="switch"
data-size={size}
className={cn(
- "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-[background-color,border-color,box-shadow] duration-150 ease-out outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-50",
+ "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-[background-color,border-color,box-shadow] duration-150 ease-out outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring aria-invalid:border-destructive data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-50",
className,
)}
{...props}
diff --git a/app/src/components/ui/table.tsx b/app/src/components/ui/table.tsx
index dfb6ea52d7..257378a8bb 100644
--- a/app/src/components/ui/table.tsx
+++ b/app/src/components/ui/table.tsx
@@ -1,4 +1,9 @@
import type * as React from "react";
+import {
+ IconArrowDown,
+ IconArrowsVertical,
+ IconArrowUp,
+} from "@/components/icons";
import { cn } from "@/lib/utils";
@@ -32,11 +37,12 @@ function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
) {
);
}
+/** A column's heading: a label, so `text-xs` in regular weight and `muted-foreground`. */
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
return (
) {
);
}
+/*
+ * A heading that sorts its column: the words and an arrow, with no fill. The arrow says the order:
+ * up for ascending, down for descending, and a pair when the column isn't sorted. The sorted
+ * column's arrow is `foreground`, its words stay `muted-foreground`. Under the pointer the words and
+ * the arrow turn `foreground`. Keyboard focus is the button's solid ring, drawn round the words; the
+ * button reaches 6px into the cell's padding on each side so the words line up with the column's.
+ * Disabled is half strength. The heading cell carries `aria-sort`.
+ */
+function TableSortButton({
+ className,
+ children,
+ sort = false,
+ ...props
+}: React.ComponentProps<"button"> & {
+ sort?: "ascending" | "descending" | false;
+}) {
+ const Arrow =
+ sort === "ascending"
+ ? IconArrowUp
+ : sort === "descending"
+ ? IconArrowDown
+ : IconArrowsVertical;
+ return (
+
+ );
+}
+
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
return (
) {
);
}
-export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow };
+export {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ TableSortButton,
+};
diff --git a/app/src/components/ui/tabs.tsx b/app/src/components/ui/tabs.tsx
index ef5d40972c..411825a49a 100644
--- a/app/src/components/ui/tabs.tsx
+++ b/app/src/components/ui/tabs.tsx
@@ -50,14 +50,21 @@ function TabsList({
);
}
+/*
+ * A tab has the control corner (`rounded-md`) on a list with the card corner (`rounded-lg`), as
+ * the design draws them, so both follow `--radius`. The words are regular, in `muted-foreground`. The chosen tab is flat: a `card` on the
+ * list's `muted`, with `foreground` words, no line and no shadow. Under the pointer a tab not
+ * chosen takes the list's fill a step darker, as a `secondary` button does. Keyboard focus is the
+ * button's solid ring. The `line` variant keeps shadcn's underline and draws no fill.
+ */
function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
return (
,
+ render = ,
...props
}: ToastPrimitive.Action.Props) {
return (
@@ -190,17 +191,32 @@ const TOAST_ICONS: Record = {
success: ,
info: ,
warning: ,
- error: ,
+ error: ,
loading: ,
};
+/*
+ * A toast is the design's notification: the card it always was, its status on the icon's 32px tile,
+ * as an alert carries it, and its words in `foreground`. A status tile is its color at 10% with the
+ * glyph in the color; information and loading sit on `muted`. tokens/tests/contrast.test.ts holds
+ * each glyph at 3:1 on its tile over a popover (the badge's pairs).
+ */
+const TOAST_TONES: Record = {
+ success: "bg-success/10 text-success",
+ warning: "bg-warning/10 text-warning",
+ error: "bg-destructive/10 text-destructive",
+};
+
function ToastIcon({ type }: { type: string | undefined }) {
const icon = type ? TOAST_ICONS[type] : undefined;
if (!icon) return null;
return (
{icon}
@@ -217,7 +233,14 @@ function ToastList() {
-
+
+ }
+ />
diff --git a/app/src/lib/artifacts/tokens.css b/app/src/lib/artifacts/tokens.css
index 1c1d3ce30e..82ed3a413a 100644
--- a/app/src/lib/artifacts/tokens.css
+++ b/app/src/lib/artifacts/tokens.css
@@ -19,8 +19,8 @@
--destructive: oklch(0.46 0.173 22.6);
--success: oklch(0.514 0.1 167.2);
--warning: oklch(0.521 0.143 47.7);
- --border: oklch(0.108 0.042 264.7 / 10%);
- --input: oklch(0.108 0.042 264.7 / 10%);
+ --border: oklch(0.928 0.001 252);
+ --input: oklch(0.928 0.001 252);
--ring: oklch(0.638 0.167 276.1);
--chart-1: oklch(0.46 0.2 264);
--chart-2: oklch(0.66 0.146 66);
@@ -34,7 +34,7 @@
--sidebar-primary-foreground: oklch(1 0 0);
--sidebar-accent: oklch(0.832 0.085 281.4 / 30%);
--sidebar-accent-foreground: oklch(0.108 0.042 264.7);
- --sidebar-border: oklch(0.108 0.042 264.7 / 10%);
+ --sidebar-border: oklch(0.928 0.001 252);
--sidebar-ring: oklch(0.638 0.167 276.1);
--radius: 0.625rem;
}
@@ -58,8 +58,8 @@
--destructive: oklch(0.792 0.121 16.4);
--success: oklch(0.832 0.13 170.1);
--warning: oklch(0.828 0.189 84.4);
- --border: oklch(0.956 0.004 252 / 12%);
- --input: oklch(0.956 0.004 252 / 12%);
+ --border: oklch(0.314 0.017 251.8);
+ --input: oklch(0.314 0.017 251.8);
--ring: oklch(0.713 0.151 277.7);
--chart-1: oklch(0.58 0.2 264);
--chart-2: oklch(0.76 0.168 66);
@@ -73,6 +73,6 @@
--sidebar-primary-foreground: oklch(0.108 0.017 252);
--sidebar-accent: oklch(0.832 0.085 281.4 / 12%);
--sidebar-accent-foreground: oklch(0.956 0.004 252);
- --sidebar-border: oklch(0.956 0.004 252 / 12%);
+ --sidebar-border: oklch(0.314 0.017 251.8);
--sidebar-ring: oklch(0.713 0.151 277.7);
}
diff --git a/app/src/routes/_authed/admin/components/$name.tsx b/app/src/routes/_authed/admin/components/$name.tsx
index 71804dec32..d775a4a682 100644
--- a/app/src/routes/_authed/admin/components/$name.tsx
+++ b/app/src/routes/_authed/admin/components/$name.tsx
@@ -200,7 +200,7 @@ function SheetRow({
}) {
return (
void }) {
diff --git a/app/src/theme.css b/app/src/theme.css
index 6bc3c73c7a..7e85e7a125 100644
--- a/app/src/theme.css
+++ b/app/src/theme.css
@@ -31,8 +31,8 @@
--destructive: oklch(0.46 0.173 22.6);
--success: oklch(0.514 0.1 167.2);
--warning: oklch(0.521 0.143 47.7);
- --border: oklch(0.108 0.042 264.7 / 10%);
- --input: oklch(0.108 0.042 264.7 / 10%);
+ --border: oklch(0.928 0.001 252);
+ --input: oklch(0.928 0.001 252);
--ring: oklch(0.638 0.167 276.1);
--chart-1: oklch(0.46 0.2 264);
--chart-2: oklch(0.66 0.146 66);
@@ -46,7 +46,7 @@
--sidebar-primary-foreground: oklch(1 0 0);
--sidebar-accent: oklch(0.832 0.085 281.4 / 30%);
--sidebar-accent-foreground: oklch(0.108 0.042 264.7);
- --sidebar-border: oklch(0.108 0.042 264.7 / 10%);
+ --sidebar-border: oklch(0.928 0.001 252);
--sidebar-ring: oklch(0.638 0.167 276.1);
/* end of tokens/src/scheme.ts */
/*
@@ -84,8 +84,8 @@
--destructive: oklch(0.792 0.121 16.4);
--success: oklch(0.832 0.13 170.1);
--warning: oklch(0.828 0.189 84.4);
- --border: oklch(0.956 0.004 252 / 12%);
- --input: oklch(0.956 0.004 252 / 12%);
+ --border: oklch(0.314 0.017 251.8);
+ --input: oklch(0.314 0.017 251.8);
--ring: oklch(0.713 0.151 277.7);
--chart-1: oklch(0.58 0.2 264);
--chart-2: oklch(0.76 0.168 66);
@@ -99,7 +99,7 @@
--sidebar-primary-foreground: oklch(0.108 0.017 252);
--sidebar-accent: oklch(0.832 0.085 281.4 / 12%);
--sidebar-accent-foreground: oklch(0.956 0.004 252);
- --sidebar-border: oklch(0.956 0.004 252 / 12%);
+ --sidebar-border: oklch(0.314 0.017 251.8);
--sidebar-ring: oklch(0.713 0.151 277.7);
/* end of tokens/src/scheme.ts */
--empty-pattern-opacity: 0.15;
diff --git a/app/tests/ui-look-guard.allowlist.json b/app/tests/ui-look-guard.allowlist.json
index 9927ee6160..4d007ec57e 100644
--- a/app/tests/ui-look-guard.allowlist.json
+++ b/app/tests/ui-look-guard.allowlist.json
@@ -21,7 +21,7 @@
},
"components/audit/audit-table.tsx": {
"corner": 1,
- "cornerStep": 2
+ "cornerStep": 1
},
"components/bot-profile/attention.tsx": {
"text": 2
diff --git a/app/tests/ui-look-theme.test.ts b/app/tests/ui-look-theme.test.ts
index fd64a85bed..c4f0839c43 100644
--- a/app/tests/ui-look-theme.test.ts
+++ b/app/tests/ui-look-theme.test.ts
@@ -50,29 +50,24 @@ describe("the look's theme values", () => {
});
/*
- * A hairline is the text color, at 10% in light and 12% in dark (Sam, 2026-12-01): about 1.25:1
- * against a card in light and 1.38:1 in dark. At 20% and 16% (1.6:1) cards and rows read heavy and
- * boxed beside ChatGPT, Claude and Grok, whose lines are 4% to 10%. One value for lines between
- * things, a field's edge and the sidebar's lines, so no line in the app is fainter than another.
- * An edge that must reach 3:1 (a checkbox's) is `muted-foreground`, never a line.
+ * A hairline is one opaque gray, the design's `Lines/border` (Figma UI Kit, 2026-12-03): #E7E7E8
+ * in light and #2B323A in dark, about 1.24:1 against a card in light and 1.36:1 in dark, as light
+ * as the lines in ChatGPT, Claude and Grok. One value for lines between things, a field's edge and
+ * the sidebar's lines. On a gray fill it is fainter than on a card: a line never has to carry a
+ * control. An edge that must reach 3:1 (a checkbox's) is `muted-foreground`, never a line.
*/
test.each([
- [":root", "10%"],
- [".dark", "12%"],
- ])("%s draws every line in the text color at %s", (selector, strength) => {
+ [":root", "oklch(0.928 0.001 252)"],
+ [".dark", "oklch(0.314 0.017 251.8)"],
+ ])("%s draws every line in one opaque gray, %s", (selector, gray) => {
const block =
new RegExp(
`(?:^|[};])\\s*${selector.replace(".", "\\.")}\\s*\\{([^}]*)\\}`,
).exec(withoutComments)?.[1] ?? "";
const value = (name: string) =>
new RegExp(`--${name}:\\s*([^;]+);`).exec(block)?.[1].trim();
- const foreground = value("foreground")?.replace(/\)$/, "");
- expect(foreground).toBeDefined();
for (const name of ["border", "input", "sidebar-border"])
- expect({ name, value: value(name) }).toEqual({
- name,
- value: `${foreground} / ${strength})`,
- });
+ expect({ name, value: value(name) }).toEqual({ name, value: gray });
});
/*
diff --git a/app/tests/ui-primitives-look.test.ts b/app/tests/ui-primitives-look.test.ts
index 3d93a45eb2..fdd6836f41 100644
--- a/app/tests/ui-primitives-look.test.ts
+++ b/app/tests/ui-primitives-look.test.ts
@@ -22,9 +22,6 @@ const ALLOWED: Partial>>> = {
"checkbox.tsx": { cornerStep: ["rounded-sm"] },
// The same 16px box, drawn for a questionnaire's choices.
"questionnaire.tsx": { cornerStep: ["rounded-sm"] },
- // A line, not depth: the pinned header's rule. A collapsed table border belongs to the rows
- // and scrolls away with them, so the line is drawn inside the header instead.
- "table.tsx": { shadow: ["shadow-[inset_0_-1px_0_var(--color-border)]"] },
};
describe("the primitives keep the look", () => {
@@ -105,11 +102,105 @@ describe("the primitives keep the look", () => {
/outline:\s*"([^"]*)"/.exec(source("button.tsx"))?.[1] ?? "";
expect(outline.split(/\s+/)).toContain("shadow-xs");
expect(has("switch.tsx", "shadow-xs")).toBe(true);
- expect(
- classes(source("tabs.tsx")).some((name) =>
- name.endsWith("data-active:shadow-xs"),
- ),
- ).toBe(true);
+ });
+
+ /*
+ * A tab has the control corner on a list with the card corner, as the design draws them
+ * (components/ui/tabs.tsx), in regular `muted-foreground` words. The chosen tab is flat: a `card`
+ * on the list's `muted`, with no line and no shadow. A tab not chosen takes a darker fill under
+ * the pointer. Focus is the button's solid ring.
+ */
+ test("a row of tabs has the control corners, its chosen tab flat, its focus the solid ring", () => {
+ const all = classes(source("tabs.tsx"));
+ expect(all).toContain("rounded-lg");
+ expect(all).toContain("rounded-md");
+ expect(all).not.toContain("rounded-full");
+ expect(all).toContain("data-active:bg-card");
+ expect(all).toContain("text-muted-foreground");
+ expect(all).toContain("font-normal");
+ expect(all.filter((name) => /(^|:)shadow-/.test(name))).toEqual([]);
+ expect(all).not.toContain("data-active:border-border");
+ expect(all.some((name) => name.includes("hover:not-data-active:bg-"))).toBe(
+ true,
+ );
+ expect(all).toContain("focus-visible:ring-ring");
+ expect(all.filter((name) => /(^|:)ring-ring\/\d+$/.test(name))).toEqual([]);
+ });
+
+ /*
+ * A table's header is a strip of `muted` with no line under it, its headings labels: `text-xs`,
+ * regular, `muted-foreground` (components/ui/table.tsx). A heading that sorts is its words and an
+ * arrow, with no fill: under the pointer they turn `foreground`. Focus is the button's solid ring.
+ */
+ test("a table's header is a muted strip, its headings regular xs labels", () => {
+ const all = classes(source("table.tsx"));
+ expect(all).toContain("bg-muted");
+ expect(all.filter((name) => /(^|:)shadow-/.test(name))).toEqual([]);
+ expect(all).toContain("[&_tr]:hover:bg-transparent");
+ expect(all).toContain("text-xs");
+ expect(all).toContain("font-normal");
+ expect(all).not.toContain("font-medium");
+ expect(all).toContain("text-muted-foreground");
+ });
+
+ test("a table's sorting heading has no fill, and the solid focus ring", () => {
+ const sort =
+ /function TableSortButton[\s\S]*?className=\{cn\(\s*"([^"]*)"/.exec(
+ source("table.tsx"),
+ )?.[1] ?? "";
+ const all = sort.split(/\s+/);
+ expect(all).toContain("hover:text-foreground");
+ expect(all.filter((name) => /(^|:)bg-/.test(name))).toEqual([]);
+ expect(all).toContain("focus-visible:border-ring");
+ expect(all).toContain("focus-visible:ring-3");
+ expect(all).toContain("focus-visible:ring-ring");
+ expect(all.filter((name) => /(^|:)ring-ring\/\d+$/.test(name))).toEqual([]);
+ });
+
+ /*
+ * A row that opens something, a link or a button, takes `muted` under the pointer, as the design's
+ * card does; a row that only shows something doesn't (components/ui/item.tsx). Focus is the
+ * button's solid ring.
+ */
+ test("a row that opens something lights under the pointer, its focus the solid ring", () => {
+ const all = classes(source("item.tsx"));
+ expect(all).toContain("[a,button]:hover:bg-muted");
+ expect(all.filter((name) => /^hover:bg-/.test(name))).toEqual([]);
+ expect(all).toContain("focus-visible:border-ring");
+ expect(all).toContain("focus-visible:ring-3");
+ expect(all).toContain("focus-visible:ring-ring");
+ expect(all.filter((name) => /(^|:)ring-ring\/\d+$/.test(name))).toEqual([]);
+ });
+
+ /*
+ * The switch, a chat bubble that is a link or a button, a questionnaire's choice and field, and a
+ * toast take the button's solid focus ring; an invalid switch or field keeps its `destructive`
+ * edge with no halo laid over the ring.
+ */
+ test.each(["switch.tsx", "bubble.tsx", "questionnaire.tsx", "toast.tsx"])(
+ "%s draws the solid focus ring, never the faded one or a halo",
+ (file) => {
+ const all = classes(source(file));
+ expect(all.some((name) => name.endsWith("focus-visible:ring-ring"))).toBe(
+ true,
+ );
+ expect(
+ all.filter((name) => /(^|:)ring-(ring|destructive)\/\d+$/.test(name)),
+ ).toEqual([]);
+ },
+ );
+
+ /*
+ * A toast is the design's notification: a popover card with its status on the icon's tile, as an
+ * alert's (components/ui/toast.tsx), and its one action the main button.
+ */
+ test("a toast carries its status on the icon's tile, and its action is the main button", () => {
+ const text = source("toast.tsx");
+ const all = classes(text);
+ for (const tone of ["success", "warning", "destructive"])
+ expect(all).toContain(`bg-${tone}/10`);
+ expect(all).toContain("size-8");
+ expect(text).not.toContain('variant="outline"');
});
test("a sidebar row keeps shadcn's sizes, and a page's menu has its own beside them", () => {
@@ -120,6 +211,157 @@ describe("the primitives keep the look", () => {
expect(sizes).toContain('page: "h-9 text-sm"');
});
+ /*
+ * A radio is shadcn's, drawn as the checkbox beside it is (components/ui/radio-group.tsx): an
+ * edge that can be seen, a ring with a dot when chosen, red when invalid as the design draws it,
+ * and the button's solid focus ring.
+ */
+ test("a radio's edge can be seen: muted-foreground, never a field's faint input", () => {
+ expect(has("radio-group.tsx", "border-muted-foreground")).toBe(true);
+ expect(has("radio-group.tsx", "border-input")).toBe(false);
+ });
+
+ test("a chosen radio is a ring in primary with a dot, never a filled disc", () => {
+ const all = classes(source("radio-group.tsx"));
+ expect(all).toContain("data-checked:border-primary");
+ expect(all.filter((name) => name.startsWith("data-checked:bg-"))).toEqual(
+ [],
+ );
+ // The dot.
+ expect(all).toContain("bg-primary");
+ });
+
+ test("an invalid radio is red, chosen or not", () => {
+ const all = classes(source("radio-group.tsx"));
+ expect(all).toContain("aria-invalid:border-destructive");
+ expect(all).toContain("aria-invalid:bg-destructive/10");
+ expect(all).toContain("aria-invalid:data-checked:border-destructive");
+ expect(all).toContain("group-aria-invalid/radio:bg-destructive");
+ expect(all).not.toContain("aria-invalid:aria-checked:border-primary");
+ });
+
+ test("a radio's keyboard focus is a solid ring in --ring, chosen or not", () => {
+ const all = classes(source("radio-group.tsx"));
+ expect(all).toContain("focus-visible:border-ring");
+ expect(all).toContain("focus-visible:ring-3");
+ expect(all).toContain("focus-visible:ring-ring");
+ // A chosen radio's `primary` edge would otherwise win over the focus edge; an invalid one keeps
+ // its `destructive` edge under the ring.
+ expect(all).toContain(
+ "data-checked:not-aria-invalid:focus-visible:border-ring",
+ );
+ // No faded ring, and no invalid halo laid over it.
+ expect(
+ all.filter((name) => /(^|:)ring-(ring|destructive)\/\d+$/.test(name)),
+ ).toEqual([]);
+ });
+
+ /*
+ * The checkbox (components/ui/checkbox.tsx): a dash when partly ticked, the button's solid focus
+ * ring, and red when invalid as the design draws it: a tint when empty, filled with `destructive`
+ * when ticked. Under the pointer an empty box or radio darkens its edge; a ticked or chosen one
+ * eases to `primary/80`, an invalid one stays as it is. Both are flat.
+ */
+ test("a partly ticked checkbox is filled, with a dash for the tick", () => {
+ const all = classes(source("checkbox.tsx"));
+ expect(all).toContain("data-indeterminate:bg-primary");
+ expect(all).toContain("group-data-indeterminate/checkbox:hidden");
+ expect(all).toContain("group-data-indeterminate/checkbox:block");
+ });
+
+ test("a checkbox's keyboard focus is the solid ring, and an invalid box is red", () => {
+ const all = classes(source("checkbox.tsx"));
+ expect(all).toContain("focus-visible:ring-ring");
+ expect(all).toContain(
+ "data-checked:not-aria-invalid:focus-visible:border-ring",
+ );
+ expect(all).toContain("aria-invalid:bg-destructive/10");
+ expect(all).toContain("aria-invalid:data-checked:bg-destructive");
+ expect(all).toContain("aria-invalid:data-indeterminate:bg-destructive");
+ expect(
+ all.filter((name) => /(^|:)ring-(ring|destructive)\/\d+$/.test(name)),
+ ).toEqual([]);
+ });
+
+ test.each(["checkbox.tsx", "radio-group.tsx"])(
+ "%s answers the pointer and stays flat",
+ (file) => {
+ const all = classes(source(file));
+ expect(all).toContain(
+ "data-unchecked:hover:not-data-disabled:not-aria-invalid:border-foreground",
+ );
+ expect(all).toContain(
+ "data-checked:hover:not-data-disabled:not-aria-invalid:border-primary/80",
+ );
+ expect(all.filter((name) => /(^|:)shadow-/.test(name))).toEqual([]);
+ },
+ );
+
+ /*
+ * A badge is shadcn's, a pill in shadcn's one size (components/ui/badge.tsx), in regular words.
+ * A status is its color's words on its 10% tint, as the design's kit draws it; the contrast test
+ * holds those words at 4.5:1. A chip is the same badge rendered as a link or a button.
+ */
+ test("a badge is a pill in one size", () => {
+ const all = classes(source("badge.tsx"));
+ expect(all).toContain("rounded-full");
+ expect(all).toContain("h-5");
+ expect(all).toContain("text-xs");
+ expect(all.filter((name) => /^(h|text)-(\d|sm|base)/.test(name))).toEqual([
+ "h-5",
+ ]);
+ });
+
+ test("a status badge is its color's words on its tint, with no dot", () => {
+ const all = classes(source("badge.tsx"));
+ for (const tone of ["success", "warning", "destructive", "in-progress"]) {
+ expect(all).toContain(`bg-${tone}/10`);
+ expect(all).toContain(`text-${tone}`);
+ expect(all).toContain(`[a,button]:hover:bg-${tone}/12`);
+ }
+ expect(all.filter((name) => name.startsWith("before:"))).toEqual([]);
+ expect(all).toContain("font-normal");
+ expect(all).not.toContain("font-medium");
+ });
+
+ test("a badge changes under the pointer only as a chip, with the solid focus ring", () => {
+ const all = classes(source("badge.tsx"));
+ expect(
+ all.filter(
+ (name) =>
+ name.includes("hover:") && !name.startsWith("[a,button]:hover:"),
+ ),
+ ).toEqual([]);
+ expect(all).toContain("focus-visible:border-ring");
+ expect(all).toContain("focus-visible:ring-3");
+ expect(all).toContain("focus-visible:ring-ring");
+ expect(
+ all.filter((name) => /(^|:)ring-(ring|destructive)\/\d+$/.test(name)),
+ ).toEqual([]);
+ });
+
+ /*
+ * An alert is shadcn's, standing in the page (components/ui/alert.tsx): a card's corner and
+ * hairline, no shadow. A status is a tint, with its color on the icon and its tile; the words
+ * are `foreground` (tokens/tests/contrast.test.ts).
+ */
+ test("an alert sits in the page: a card's corner and hairline, no shadow", () => {
+ const all = classes(source("alert.tsx"));
+ expect(all).toContain("rounded-lg");
+ expect(all).toContain("border-border");
+ expect(all.filter((name) => /(^|:)shadow-/.test(name))).toEqual([]);
+ });
+
+ test("an alert's status is a tint and an icon, with foreground words", () => {
+ const all = classes(source("alert.tsx"));
+ for (const tone of ["destructive", "success", "warning"]) {
+ expect(all).toContain(`bg-${tone}/10`);
+ expect(all).toContain(`[&>svg]:text-${tone}`);
+ expect(all).not.toContain(`text-${tone}`);
+ }
+ expect(all).toContain("*:data-[slot=alert-description]:text-foreground");
+ });
+
test("the page's panel is flat, with the card's corner", () => {
const inset = classes(source("sidebar.tsx")).filter((name) =>
name.includes("peer-data-[variant=inset]:"),
diff --git a/desktop/src-tauri/src/connected/sign_in.rs b/desktop/src-tauri/src/connected/sign_in.rs
index 6c3a15d8c4..55c4a613e1 100644
--- a/desktop/src-tauri/src/connected/sign_in.rs
+++ b/desktop/src-tauri/src/connected/sign_in.rs
@@ -1367,7 +1367,7 @@ const END_PAGE_STYLE: &str = r#"
--foreground: oklch(0.108 0.042 264.7);
--card: oklch(1 0 0);
--muted-foreground: oklch(0.506 0.045 257.4);
- --border: oklch(0.108 0.042 264.7 / 10%);
+ --border: oklch(0.928 0.001 252);
--sidebar: oklch(0.948 0.01 251.8);
/* end of tokens/src/scheme.ts */
--shadow: 0 1px 2px oklch(0.108 0.042 264.7 / 4%), 0 24px 64px -16px oklch(0.45 0.12 276 / 22%);
@@ -1382,7 +1382,7 @@ const END_PAGE_STYLE: &str = r#"
--foreground: oklch(0.956 0.004 252);
--card: oklch(0.212 0.017 252);
--muted-foreground: oklch(0.69 0.016 252);
- --border: oklch(0.956 0.004 252 / 12%);
+ --border: oklch(0.314 0.017 251.8);
--sidebar: oklch(0.156 0.017 252);
/* end of tokens/src/scheme.ts */
--shadow: 0 1px 2px oklch(0 0 0 / 30%), 0 24px 64px -16px oklch(0 0 0 / 60%);
diff --git a/desktop/src-tauri/src/first_paint.rs b/desktop/src-tauri/src/first_paint.rs
index 77baa2480a..b2ccd7e660 100644
--- a/desktop/src-tauri/src/first_paint.rs
+++ b/desktop/src-tauri/src/first_paint.rs
@@ -67,7 +67,7 @@ pub const LIGHT: Palette = Palette {
// tokens/src/scheme.ts, light: ground=sidebar card=card border=border ink=foreground soft=muted-foreground (bun run tokens:generate)
ground: (0xe9, 0xee, 0xf4),
card: (0xff, 0xff, 0xff),
- border: (0xe6, 0xe6, 0xe7),
+ border: (0xe7, 0xe7, 0xe8),
ink: (0x01, 0x03, 0x13),
soft: (0x55, 0x66, 0x7f),
// end of tokens/src/scheme.ts
@@ -78,7 +78,7 @@ pub const DARK: Palette = Palette {
// tokens/src/scheme.ts, dark: ground=sidebar card=card border=border ink=foreground soft=muted-foreground (bun run tokens:generate)
ground: (0x07, 0x0d, 0x14),
card: (0x13, 0x19, 0x20),
- border: (0x2d, 0x33, 0x39),
+ border: (0x2b, 0x32, 0x3a),
ink: (0xee, 0xf1, 0xf3),
soft: (0x94, 0x9c, 0xa5),
// end of tokens/src/scheme.ts
diff --git a/desktop/src/styles.css b/desktop/src/styles.css
index f15a804dc0..f3645c4a47 100644
--- a/desktop/src/styles.css
+++ b/desktop/src/styles.css
@@ -32,8 +32,8 @@
--muted-foreground: oklch(0.506 0.045 257.4);
--destructive: oklch(0.46 0.173 22.6);
--success: oklch(0.514 0.1 167.2);
- --border: oklch(0.108 0.042 264.7 / 10%);
- --input: oklch(0.108 0.042 264.7 / 10%);
+ --border: oklch(0.928 0.001 252);
+ --input: oklch(0.928 0.001 252);
--ring: oklch(0.638 0.167 276.1);
--sidebar: oklch(0.948 0.01 251.8);
--sidebar-accent: oklch(0.832 0.085 281.4 / 30%);
@@ -2527,8 +2527,8 @@ main > .sheet:has(.journey.handing-off) .self-contained-why {
--muted-foreground: oklch(0.69 0.016 252);
--destructive: oklch(0.792 0.121 16.4);
--success: oklch(0.832 0.13 170.1);
- --border: oklch(0.956 0.004 252 / 12%);
- --input: oklch(0.956 0.004 252 / 12%);
+ --border: oklch(0.314 0.017 251.8);
+ --input: oklch(0.314 0.017 251.8);
--ring: oklch(0.713 0.151 277.7);
--sidebar: oklch(0.156 0.017 252);
--sidebar-accent: oklch(0.832 0.085 281.4 / 12%);
diff --git a/docs/app-guidelines.md b/docs/app-guidelines.md
index dc973e180f..249fccb189 100644
--- a/docs/app-guidelines.md
+++ b/docs/app-guidelines.md
@@ -358,23 +358,24 @@ changes, for every screen at once, in a change agreed first.
1. **Colors.** Only the scheme's tokens, as above.
2. **Type.** Figtree on Tailwind's own type scale, in whole pixels: `text-xs` is 12px, `text-sm`
14px, `text-base` 16px and a page title's `text-2xl` 24px. Controls, rows and navigation are
- `text-sm`; labels, times and counts are `text-xs`. The line under a row's name
- (`ItemDescription`) is `text-sm` too, in `muted-foreground`: the name's weight and color set it
- apart. No text size written by hand (`text-[13px]`).
+ `text-sm`; labels (a table's column headings among them), times and counts are `text-xs`. The
+ line under a row's name (`ItemDescription`) is `text-sm` too, in `muted-foreground`: the name's
+ weight and color set it apart. No text size written by hand (`text-[13px]`).
3. **Corners.** All from `--radius`, 10px, the design's radius base. Controls are `rounded-md`
(8px), cards and the page's panel `rounded-lg` (10px), menus, dialogs and the message box
`rounded-xl` (14px), round things `rounded-full`. `rounded-none` squares a part off. No other
step and no corner of its own (`rounded-[20px]`).
4. **Surfaces.** The frame (`sidebar`), the panel the page sits in (`background`), cards on it
(`card`). A card has a hairline border in light and in dark. Every line (`border`, a field's
- `input`, the sidebar's `sidebar-border`) is the text color at 10% in light and 12% in dark,
- about 1.25:1 against a card in light and 1.38:1 in dark, so no line in the app is fainter than
- another. A line is never the only cue of a control: a checkbox's edge is `muted-foreground`.
+ `input`, the sidebar's `sidebar-border`) is one opaque gray, the design's `Lines/border`:
+ #E7E7E8 in light and #2B323A in dark, about 1.24:1 against a card in light and 1.36:1 in dark,
+ fainter on a gray fill. A line is never the only cue of a control: a checkbox's edge is
+ `muted-foreground`.
5. **Shadows.** A shadow says how far something floats, as Linear draws it, and Tailwind's own
steps only:
- none for everything in the page: the panel, cards, rows, fields, the sidebar;
- - `shadow-xs` for a control pressed on a surface: an outlined button, a switch's knob, the
- chosen tab, a checkbox;
+ - `shadow-xs` for a control pressed on a surface: an outlined button, a switch's knob. A
+ checkbox, a radio and the chosen tab are flat;
- `shadow-lg` and a border for what opens beside the thing that opened it: menus, selects,
popovers, tooltips, toasts;
- `shadow-2xl` and a border for what sits over the app: dialogs, the command menu, sheets.
diff --git a/docs/design-system.md b/docs/design-system.md
index 08ae60b509..8424cfe5ca 100644
--- a/docs/design-system.md
+++ b/docs/design-system.md
@@ -29,9 +29,9 @@ compatible means two things stay true, and a change is checked against both:
1. **A stock shadcn component fits in.** Copy a component from shadcn's registry into
`components/ui`, in its Base UI flavor, and it takes our colors, corners and type from the
- tokens as it is. The one edit it may need is to its corner and shadow steps, to the ones
- [the look](app-guidelines.md#the-look) names. If it needs more than that, the system has
- drifted.
+ tokens as it is. The edits it may need are its corner and shadow steps, to the ones
+ [the look](app-guidelines.md#the-look) names, and its focus ring, made solid (see
+ [Primitives](#primitives)). If it needs more than that, the system has drifted.
2. **A stock shadcn theme restyles everything.** Set only shadcn's standard variables
(`--background`, `--primary`, `--radius` and the rest) and the whole app follows: every
primitive, every screen, light and dark.
@@ -51,10 +51,12 @@ A screen is a few surfaces, one on another. Each level has its token, and the to
| Beside | `popover` | What opens beside what opened it: menus, selects, popovers. | A border and `shadow-lg` |
| Over | `popover` | What sits over the app: dialogs, sheets, the command menu. | A border and `shadow-2xl` |
-On a surface, a fill marks a part of it: `secondary` and `muted` for a button, a badge or a tile,
-`accent` for the highlighted row of a menu. Each surface and fill has a `-foreground` for the text
-on it. Every line is `border`, the text color at one strength (10% in light, 12% in dark), so no
-line is fainter than another.
+On a surface, a fill marks a part of it: `secondary` and `muted` for a button, a badge, a tile or a
+table's header, `accent` for the highlighted row of a menu. Each surface and fill has a
+`-foreground` for the text on it. Every line is `border`, one opaque gray, the design's
+`Lines/border` (#E7E7E8 in light, #2B323A in dark): a line between things, a field's edge and the
+sidebar's lines are the same value. It is about 1.24:1 on a card and fainter on a gray fill, so a
+line never carries a control on its own.
- **Choose the level by what the thing is,** never by the shade you want. A form is a card. A
list of rows sits on the panel, split by lines, with no card. If a card looks wrong where you
@@ -96,7 +98,8 @@ changed in `tokens/src/scheme.ts` and written out with `bun run tokens:generate`
`--spacing-menu-item-x`, not `--radius-card`. A stock shadcn theme doesn't set them, so they stay
at our values while everything else changes, and the theme is broken. A state is made from the
tokens there are, as shadcn does it: hover is `hover:bg-primary/80` or `hover:bg-muted`, disabled
- is `disabled:opacity-50`, focus is `ring-ring/50`, invalid is `destructive`.
+ is `disabled:opacity-50`, focus is a solid ring in `ring` (see [Primitives](#primitives)),
+ invalid is `destructive`.
- **A token is a token wherever it is declared.** `:root`, `.dark`, `@theme` or a component's own
stylesheet: the rules above hold for all of them. The test reads only `:root` and `.dark`; the
rule is wider than the test.
@@ -132,6 +135,14 @@ changed in `tokens/src/scheme.ts` and written out with `bun run tokens:generate`
screens as they were, it is the wrong change.
- **Every state, both modes.** A primitive is done when rest, hover, focus, pressed, disabled and
invalid are all drawn, in light and in dark, and the keyboard reaches it.
+- **Keyboard focus is a solid ring in `ring`, drawn outside the control.** The edge turns `ring`
+ and 3px more are drawn outside it, 4px in all: `focus-visible:border-ring focus-visible:ring-3
+ focus-visible:ring-ring`, or the same on `has-[…:focus-visible]` where a field is a group.
+ Outside, the ring is read against what the control stands on, which
+ `tokens/tests/contrast.test.ts` holds at 3:1; shadcn's half-strength `ring-ring/50` is 1.75:1 on
+ the page in light. No state fades the ring or gives it another color: an invalid field keeps its
+ `destructive` edge and gets the same ring. A primitive that still draws the half ring moves to
+ this one in a pull request of its own.
## The rest of the look
@@ -156,10 +167,13 @@ icons a screen draws with. What it leaves to this page:
onboarding and empty states included. If a design hands you a video of an animation, build the
animation.
- **Check contrast before you choose a color,** in light and in dark: 4.5:1 for text, 3:1 for the
- edge of a control that has no other cue, such as a checkbox, and for the focus ring. A line
- (`border`, `input`) is about 1.25:1 against a card in light and 1.38:1 in dark, so such an edge,
- and a mark like the scrollbar's thumb, is `muted-foreground`, never a line. A color that fails as
- text is not rescued with a second token for "the same color, as text".
+ edge of a control that has no other cue, such as a checkbox or a radio, and for the focus ring. A
+ line (`border`, `input`) is about 1.24:1 against a card in light and 1.36:1 in dark, so such an
+ edge, and a mark like the scrollbar's thumb, is `muted-foreground`, never a line. A status color
+ is used for words only where it holds 4.5:1 on its own 10% tint over every surface, as a badge's
+ words do (`tokens/tests/contrast.test.ts`). A color that fails as text is not rescued with a
+ second token for "the same color, as text": the words go in `foreground` and the color goes on a
+ mark, as an alert or a toast carries it on its icon's tile.
- **Motion stops when less motion is asked for.** An animation in code can stand still. Don't
swap in a picture of one frame.
@@ -204,7 +218,7 @@ A change to a token or a primitive changes every screen, so it lands differently
| [`app/tests/color-scheme.test.ts`](../app/tests/color-scheme.test.ts) | No class from Tailwind's palette in a screen. |
| [`app/tests/ui-look-guard.test.ts`](../app/tests/ui-look-guard.test.ts) | No corner, shadow, text size, `dark:` color or hand-drawn card of a screen's own. |
| [`app/tests/ui-primitives-look.test.ts`](../app/tests/ui-primitives-look.test.ts) | Every primitive keeps the look's corner and shadow steps, a copied shadcn one included. |
-| [`app/tests/ui-look-theme.test.ts`](../app/tests/ui-look-theme.test.ts) | The one radius, the icons' line, and every line at one strength. |
+| [`app/tests/ui-look-theme.test.ts`](../app/tests/ui-look-theme.test.ts) | The one radius, the icons' line, and every line in one opaque gray. |
| [`app/tests/icon-set.test.ts`](../app/tests/icon-set.test.ts) | One icon set in the web app, the extension and OpenBot Desktop, taken from its module. |
| [`tokens/tests/slate.test.ts`](../tokens/tests/slate.test.ts) | The grays are one family, in light and in dark. |
| [`tokens/tests/contrast.test.ts`](../tokens/tests/contrast.test.ts) | Text reads on the surfaces it is set on (4.5:1) and the focus ring shows (3:1), in light and in dark. |
diff --git a/mobile/global.css b/mobile/global.css
index 87f0a846eb..0872bae5e1 100644
--- a/mobile/global.css
+++ b/mobile/global.css
@@ -51,7 +51,7 @@
--field-background: oklch(1 0 0);
--field-foreground: oklch(0.108 0.042 264.7);
--field-placeholder: oklch(0.506 0.045 257.4);
- --field-border: oklch(0.108 0.042 264.7 / 10%);
+ --field-border: oklch(0.928 0.001 252);
--success: oklch(0.514 0.1 167.2);
--success-foreground: oklch(1 0 0);
--warning: oklch(0.521 0.143 47.7);
@@ -60,8 +60,8 @@
--danger-foreground: oklch(1 0 0);
--segment: oklch(1 0 0);
--segment-foreground: oklch(0.108 0.042 264.7);
- --border: oklch(0.108 0.042 264.7 / 10%);
- --separator: oklch(0.108 0.042 264.7 / 10%);
+ --border: oklch(0.928 0.001 252);
+ --separator: oklch(0.928 0.001 252);
--focus: oklch(0.638 0.167 276.1);
--link: oklch(0.108 0.042 264.7);
--fill: oklch(0.956 0.009 250.2);
@@ -69,7 +69,7 @@
--sidebar-foreground: oklch(0.108 0.042 264.7);
--sidebar-accent: oklch(0.832 0.085 281.4 / 30%);
--sidebar-accent-foreground: oklch(0.108 0.042 264.7);
- --sidebar-border: oklch(0.108 0.042 264.7 / 10%);
+ --sidebar-border: oklch(0.928 0.001 252);
/* end of tokens/src/scheme.ts */
}
@variant dark {
@@ -92,7 +92,7 @@
--field-background: oklch(0.212 0.017 252);
--field-foreground: oklch(0.956 0.004 252);
--field-placeholder: oklch(0.69 0.016 252);
- --field-border: oklch(0.956 0.004 252 / 12%);
+ --field-border: oklch(0.314 0.017 251.8);
--success: oklch(0.832 0.13 170.1);
--success-foreground: oklch(0.108 0.017 252);
--warning: oklch(0.828 0.189 84.4);
@@ -101,8 +101,8 @@
--danger-foreground: oklch(0.108 0.017 252);
--segment: oklch(0.212 0.017 252);
--segment-foreground: oklch(0.956 0.004 252);
- --border: oklch(0.956 0.004 252 / 12%);
- --separator: oklch(0.956 0.004 252 / 12%);
+ --border: oklch(0.314 0.017 251.8);
+ --separator: oklch(0.314 0.017 251.8);
--focus: oklch(0.713 0.151 277.7);
--link: oklch(0.956 0.004 252);
--fill: oklch(0.253 0.017 252);
@@ -110,7 +110,7 @@
--sidebar-foreground: oklch(0.956 0.004 252);
--sidebar-accent: oklch(0.832 0.085 281.4 / 12%);
--sidebar-accent-foreground: oklch(0.956 0.004 252);
- --sidebar-border: oklch(0.956 0.004 252 / 12%);
+ --sidebar-border: oklch(0.314 0.017 251.8);
/* end of tokens/src/scheme.ts */
}
}
diff --git a/mobile/src/scheme.ts b/mobile/src/scheme.ts
index 69e1a20777..3980b4f64e 100644
--- a/mobile/src/scheme.ts
+++ b/mobile/src/scheme.ts
@@ -20,8 +20,8 @@ export const scheme = {
destructive: "#a31526",
success: "#12795b",
warning: "#a84900",
- border: "#0103131a",
- input: "#0103131a",
+ border: "#e7e7e8",
+ input: "#e7e7e8",
ring: "#727eef",
"chart-1": "#1949c5",
"chart-2": "#cd7d04",
@@ -35,7 +35,7 @@ export const scheme = {
"sidebar-primary-foreground": "#ffffff",
"sidebar-accent": "#bec2ff4d",
"sidebar-accent-foreground": "#010313",
- "sidebar-border": "#0103131a",
+ "sidebar-border": "#e7e7e8",
"sidebar-ring": "#727eef",
},
dark: {
@@ -56,8 +56,8 @@ export const scheme = {
destructive: "#ff9aa0",
success: "#5fe3bb",
warning: "#ffb900",
- border: "#eef1f31f",
- input: "#eef1f31f",
+ border: "#2b323a",
+ input: "#2b323a",
ring: "#8d97ff",
"chart-1": "#3a70ee",
"chart-2": "#f79807",
@@ -71,7 +71,7 @@ export const scheme = {
"sidebar-primary-foreground": "#020409",
"sidebar-accent": "#bec2ff1f",
"sidebar-accent-foreground": "#eef1f3",
- "sidebar-border": "#eef1f31f",
+ "sidebar-border": "#2b323a",
"sidebar-ring": "#8d97ff",
},
} as const;
diff --git a/tokens/src/scheme.ts b/tokens/src/scheme.ts
index 53796c0e94..31763472fe 100644
--- a/tokens/src/scheme.ts
+++ b/tokens/src/scheme.ts
@@ -82,13 +82,14 @@ const light: Palette = {
success: "oklch(0.514 0.1 167.2)",
warning: "oklch(0.521 0.143 47.7)",
/*
- * Every line (`border`, `input`, `sidebar-border`) is the text color at one strength: 10% here,
- * 12% in dark. That is about 1.25:1 against a card in light and 1.38:1 in dark, as light as the
- * lines in ChatGPT, Claude and Grok. A line is never the only cue of a control: a checkbox's or a
- * radio's edge is `muted-foreground` (docs/design-system.md).
+ * Every line (`border`, `input`, `sidebar-border`) is one opaque gray, the design's `Lines/border`:
+ * #E7E7E8 here, #2B323A in dark. That is about 1.24:1 against a card in light and 1.36:1 in dark;
+ * on a gray fill (`muted`, `secondary`, the sidebar) it is fainter, about 1.1:1 in light. A line
+ * is never the only cue of a control: a checkbox's or a radio's edge is `muted-foreground`
+ * (docs/design-system.md).
*/
- border: "oklch(0.108 0.042 264.7 / 10%)",
- input: "oklch(0.108 0.042 264.7 / 10%)",
+ border: "oklch(0.928 0.001 252)",
+ input: "oklch(0.928 0.001 252)",
ring: "oklch(0.638 0.167 276.1)",
/*
* The chart series are OpenBot's own hues: the brand blue, warning's amber, success's teal,
@@ -108,7 +109,7 @@ const light: Palette = {
"sidebar-primary-foreground": "oklch(1 0 0)",
"sidebar-accent": "oklch(0.832 0.085 281.4 / 30%)",
"sidebar-accent-foreground": "oklch(0.108 0.042 264.7)",
- "sidebar-border": "oklch(0.108 0.042 264.7 / 10%)",
+ "sidebar-border": "oklch(0.928 0.001 252)",
"sidebar-ring": "oklch(0.638 0.167 276.1)",
};
@@ -137,8 +138,8 @@ const dark: Palette = {
destructive: "oklch(0.792 0.121 16.4)",
success: "oklch(0.832 0.13 170.1)",
warning: "oklch(0.828 0.189 84.4)",
- border: "oklch(0.956 0.004 252 / 12%)",
- input: "oklch(0.956 0.004 252 / 12%)",
+ border: "oklch(0.314 0.017 251.8)",
+ input: "oklch(0.314 0.017 251.8)",
ring: "oklch(0.713 0.151 277.7)",
"chart-1": "oklch(0.58 0.2 264)",
"chart-2": "oklch(0.76 0.168 66)",
@@ -152,7 +153,7 @@ const dark: Palette = {
"sidebar-primary-foreground": "oklch(0.108 0.017 252)",
"sidebar-accent": "oklch(0.832 0.085 281.4 / 12%)",
"sidebar-accent-foreground": "oklch(0.956 0.004 252)",
- "sidebar-border": "oklch(0.956 0.004 252 / 12%)",
+ "sidebar-border": "oklch(0.314 0.017 251.8)",
"sidebar-ring": "oklch(0.713 0.151 277.7)",
};
diff --git a/tokens/tests/contrast.test.ts b/tokens/tests/contrast.test.ts
index 6257a273fe..2c1f3666a4 100644
--- a/tokens/tests/contrast.test.ts
+++ b/tokens/tests/contrast.test.ts
@@ -9,15 +9,18 @@ import { type Mode, scheme, type Token } from "../src/scheme";
* second token for "the same color, as text".
*
* WCAG 2's relative luminance and contrast ratio (tokens/src/color.ts), on the scheme's sRGB
- * values. A translucent color (the selected sidebar row's tint) is laid over the surface it sits
- * on first.
+ * values. A translucent color (the selected sidebar row's tint, an invalid field's
+ * `destructive/10`) is laid over the surface it sits on first.
*/
const TEXT = 4.5;
const NON_TEXT = 3;
+/** A surface: a token, or a token at an opacity as Tailwind writes it (`destructive/10`). */
+type Layer = Token | `${Token}/${number}`;
+
/** [what is read, the surfaces it is read on (a translucent one over the one after it), minimum] */
-const PAIRS: [Token, Token[], number][] = [
+const PAIRS: [Token, Layer[], number][] = [
["foreground", ["background"], TEXT],
["card-foreground", ["card"], TEXT],
["popover-foreground", ["popover"], TEXT],
@@ -36,13 +39,35 @@ const PAIRS: [Token, Token[], number][] = [
["sidebar-foreground", ["sidebar"], TEXT],
["sidebar-primary-foreground", ["sidebar-primary"], TEXT],
["sidebar-accent-foreground", ["sidebar-accent", "sidebar"], TEXT],
+ // An alert's words on its tint, and its icon on its tile (the tint again, over the tint), wherever
+ // an alert stands: the page, a card, a menu, a muted row.
+ ...(["background", "card", "popover", "muted"] as const).flatMap(
+ (ground): [Token, Layer[], number][] =>
+ (["destructive", "success", "warning"] as const).flatMap(
+ (tone): [Token, Layer[], number][] => [
+ ["foreground", [`${tone}/10`, ground], TEXT],
+ [tone, [`${tone}/10`, `${tone}/10`, ground], NON_TEXT],
+ ],
+ ),
+ ),
["ring", ["background"], NON_TEXT],
["ring", ["card"], NON_TEXT],
+ // A control's ring is drawn outside it, on whatever it stands on: a dialog, a muted row.
+ ["ring", ["popover"], NON_TEXT],
+ ["ring", ["muted"], NON_TEXT],
["sidebar-ring", ["sidebar"], NON_TEXT],
];
-function surface(mode: Mode, layers: Token[]): Rgb {
- const colors = layers.map((token) => oklchToRgb(scheme[mode][token]));
+function color(mode: Mode, layer: Layer): Rgb {
+ const [token, percent] = layer.split("/") as [Token, string | undefined];
+ const rgb = oklchToRgb(scheme[mode][token]);
+ return percent === undefined
+ ? rgb
+ : { ...rgb, alpha: (rgb.alpha * Number(percent)) / 100 };
+}
+
+function surface(mode: Mode, layers: Layer[]): Rgb {
+ const colors = layers.map((layer) => color(mode, layer));
return colors.reduceRight((under, top) => over(top, under));
}
diff --git a/tokens/tests/generated.test.ts b/tokens/tests/generated.test.ts
index 85c4a86e2a..2bcda02471 100644
--- a/tokens/tests/generated.test.ts
+++ b/tokens/tests/generated.test.ts
@@ -92,27 +92,44 @@ describe("oklch to hex", () => {
describe("an RGB copy of a translucent color", () => {
/*
- * An RGB copy (the desktop window's first paint) has no opacity. A translucent color, such as a
- * line drawn as the text color at 12%, is written as it shows on a card: blended over `card`,
- * the surface every line in the first paint sits on. Dropping the opacity would draw the line at
- * full strength.
+ * An RGB copy (the desktop window's first paint) has no opacity. A translucent color, such as the
+ * sidebar's highlighted row (`sidebar-accent`, lavender at 30% in light and 12% in dark), is
+ * written as it shows on a card: blended over `card`. Dropping the opacity would draw it at full
+ * strength. The lines are opaque (`border`), so they are written as they are.
*/
test.each(["light", "dark"] as const)(
- "%s: the border is written blended over the card",
+ "%s: a translucent color is written blended over the card",
(mode) => {
const region = [
- ` // tokens/src/scheme.ts, ${mode}: edge=border (bun run tokens:generate)`,
+ ` // tokens/src/scheme.ts, ${mode}: tint=sidebar-accent (bun run tokens:generate)`,
" // end of tokens/src/scheme.ts",
].join("\n");
const written = fillRegions(region, "example.rs");
- const line = oklchToRgb(scheme[mode].border);
+ const tint = oklchToRgb(scheme[mode]["sidebar-accent"]);
const card = oklchToRgb(scheme[mode].card);
- expect(line.alpha).toBeLessThan(1);
+ expect(tint.alpha).toBeLessThan(1);
const blend = (top: number, under: number) =>
- Math.round(top * line.alpha + under * (1 - line.alpha));
+ Math.round(top * tint.alpha + under * (1 - tint.alpha));
const hex = (n: number) => `0x${n.toString(16).padStart(2, "0")}`;
- const expected = `edge: (${hex(blend(line.r, card.r))}, ${hex(blend(line.g, card.g))}, ${hex(blend(line.b, card.b))}),`;
+ const expected = `tint: (${hex(blend(tint.r, card.r))}, ${hex(blend(tint.g, card.g))}, ${hex(blend(tint.b, card.b))}),`;
expect(written).toContain(expected);
},
);
+
+ test.each(["light", "dark"] as const)(
+ "%s: the opaque border is written as it is",
+ (mode) => {
+ const region = [
+ ` // tokens/src/scheme.ts, ${mode}: edge=border (bun run tokens:generate)`,
+ " // end of tokens/src/scheme.ts",
+ ].join("\n");
+ const line = oklchToRgb(scheme[mode].border);
+ expect(line.alpha).toBe(1);
+ const hex = (n: number) =>
+ `0x${Math.round(n).toString(16).padStart(2, "0")}`;
+ expect(fillRegions(region, "example.rs")).toContain(
+ `edge: (${hex(line.r)}, ${hex(line.g)}, ${hex(line.b)}),`,
+ );
+ },
+ );
});