Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(theme): give pull request states their own theme variables (#10487)
xiaoke12345678cd324c6f16e3
diff --git a/docs/theming.md b/docs/theming.mdindex 49f47ab369..5f3f099263 100644--- a/docs/theming.md+++ b/docs/theming.md@@ -472,6 +472,9 @@ and dark differ, both defaults are given.| `--priority-medium` | `var(--warning)` | Medium priority icon and badge. || `--priority-low` | `var(--info)` | Low priority icon and badge. || `--priority-none` | `var(--muted-foreground)` | No-priority icon. |+| `--pr-open` | `oklch(59.6% 0.145 163.225)` / `oklch(76.5% 0.177 163.223)` | Open pull request icon. |+| `--pr-merged` | `oklch(54.1% 0.281 293.009)` / `oklch(70.2% 0.183 293.541)` | Merged pull request icon and pill. The pill's text defaults one shade darker in light mode. |+| `--pr-closed` | `oklch(58.6% 0.253 17.585)` / `oklch(71.2% 0.194 13.428)` | Closed pull request icon. |### Shape and depthdiff --git a/packages/core/appearance/theme-variables.ts b/packages/core/appearance/theme-variables.tsindex 44f1403daa..e61de9b14f 100644--- a/packages/core/appearance/theme-variables.ts+++ b/packages/core/appearance/theme-variables.ts@@ -145,6 +145,9 @@ const STATUS: Entry[] = [["priority-medium", "Medium priority icon and badge.", "var(--warning)"],["priority-low", "Low priority icon and badge.", "var(--info)"],["priority-none", "No-priority icon.", "var(--muted-foreground)"],+ ["pr-open", "Open pull request icon.", "oklch(59.6% 0.145 163.225)", "oklch(76.5% 0.177 163.223)"],+ ["pr-merged", "Merged pull request icon and pill. The pill's text defaults one shade darker in light mode.", "oklch(54.1% 0.281 293.009)", "oklch(70.2% 0.183 293.541)"],+ ["pr-closed", "Closed pull request icon.", "oklch(58.6% 0.253 17.585)", "oklch(71.2% 0.194 13.428)"],];const SHAPE: Entry[] = [diff --git a/packages/ui/styles/theme-variables.css b/packages/ui/styles/theme-variables.cssindex f86937362a..e2bb9aa6c9 100644--- a/packages/ui/styles/theme-variables.css+++ b/packages/ui/styles/theme-variables.css@@ -75,6 +75,17 @@--color-priority-medium: var(--priority-medium, var(--warning));--color-priority-low: var(--priority-low, var(--info));--color-priority-none: var(--priority-none, var(--muted-foreground));+ /* Pull request states keep GitHub's hues by default, a shade lighter in+ dark mode, so each has a dark alias reading the same public name. The+ Merged pill's light-mode text defaults one shade darker again, so 11px+ copy on its tint keeps AA contrast on every surface. */+ --color-pr-open: var(--pr-open, oklch(59.6% 0.145 163.225));+ --color-pr-open-dark: var(--pr-open, oklch(76.5% 0.177 163.223));+ --color-pr-merged: var(--pr-merged, oklch(54.1% 0.281 293.009));+ --color-pr-merged-dark: var(--pr-merged, oklch(70.2% 0.183 293.541));+ --color-pr-merged-text: var(--pr-merged, oklch(49.1% 0.27 292.581));+ --color-pr-closed: var(--pr-closed, oklch(58.6% 0.253 17.585));+ --color-pr-closed-dark: var(--pr-closed, oklch(71.2% 0.194 13.428));}/* Icon stroke: only glyphs drawn at the default width follow it, so a calldiff --git a/packages/views/issues/components/pull-request-chips.tsx b/packages/views/issues/components/pull-request-chips.tsxindex dcb5ee0809..e7c4de4a5b 100644--- a/packages/views/issues/components/pull-request-chips.tsx+++ b/packages/views/issues/components/pull-request-chips.tsx@@ -19,10 +19,10 @@ export const PULL_REQUEST_STATE_ICON: Record<GitHubPullRequestState,{ icon: React.ComponentType<{ className?: string }>; className: string }> = {- open: { icon: GitPullRequestArrow, className: "text-emerald-600 dark:text-emerald-400" },+ open: { icon: GitPullRequestArrow, className: "text-pr-open dark:text-pr-open-dark" },draft: { icon: GitPullRequestDraft, className: "text-muted-foreground" },- merged: { icon: GitMerge, className: "text-violet-600 dark:text-violet-400" },- closed: { icon: GitPullRequestClosed, className: "text-rose-600 dark:text-rose-400" },+ merged: { icon: GitMerge, className: "text-pr-merged dark:text-pr-merged-dark" },+ closed: { icon: GitPullRequestClosed, className: "text-pr-closed dark:text-pr-closed-dark" },};const EMPTY: readonly IssuePullRequestSummary[] = [];diff --git a/packages/views/issues/components/pull-request-list.tsx b/packages/views/issues/components/pull-request-list.tsxindex b71449c97e..3718645f06 100644--- a/packages/views/issues/components/pull-request-list.tsx+++ b/packages/views/issues/components/pull-request-list.tsx@@ -344,12 +344,13 @@ const PROBLEM_LIMIT = 3;type VerdictTone = "red" | "amber" | "green" | "violet" | "muted";// Pills reuse the state icons' palette. Their text sits one shade darker so-// 11px copy on a 10% tint keeps AA contrast.+// 11px copy on a 10% tint keeps AA contrast. Merged is a pull request state,+// so it follows the theme's --pr-merged.const TONE_CLASS: Record<VerdictTone, string> = {red: "bg-rose-600/10 text-rose-700 dark:bg-rose-400/15 dark:text-rose-400",amber: "bg-amber-600/10 text-amber-700 dark:bg-amber-400/15 dark:text-amber-400",green: "bg-emerald-600/10 text-emerald-700 dark:bg-emerald-400/15 dark:text-emerald-400",- violet: "bg-violet-600/10 text-violet-700 dark:bg-violet-400/15 dark:text-violet-400",+ violet: "bg-pr-merged/10 text-pr-merged-text dark:bg-pr-merged-dark/15 dark:text-pr-merged-dark",muted: "bg-muted text-muted-foreground",};diff --git a/scripts/theme-preview.test.mjs b/scripts/theme-preview.test.mjsindex 678a9fee08..0e5e08d056 100644--- a/scripts/theme-preview.test.mjs+++ b/scripts/theme-preview.test.mjs@@ -154,6 +154,16 @@ const EXPECTED = [],source: "packages/ui/components/ui/switch.tsx",},+ ...[+ ["open", "git-pull-request-arrow"],+ ["merged", "git-merge"],+ ["closed", "git-pull-request-closed"],+ ].map(([state, icon]) => ({+ what: `the ${state} pull request chip icons`,+ find: (els) => els.filter((el) => el.tag === "svg" && el.classes.has(`icon-${icon}`)),+ classes: [`text-pr-${state}`, `dark:text-pr-${state}-dark`],+ source: "packages/views/issues/components/pull-request-chips.tsx",+ })),{what: "the small buttons",find: (els) => els.filter((el) => "data-variant" in el.attrs && ["sm", "icon-sm", "icon-xs"].includes(el.attrs["data-size"])),@@ -199,6 +209,7 @@ const NOT_DRAWN = {"status-blocked": "no blocked issue is listed","status-cancelled": "no cancelled issue is listed","priority-none": "every listed issue has a priority",+ "pr-merged-text": "the issue's pull request list is not shown",},};diff --git a/scripts/theme-preview/fixture.html b/scripts/theme-preview/fixture.htmlindex 2cefaf0a84..8ed326fcea 100644--- a/scripts/theme-preview/fixture.html+++ b/scripts/theme-preview/fixture.html@@ -99,7 +99,7 @@</div><div data-slot="issue-list-row" data-mc="issue-row" data-status="in_progress" data-priority="medium" data-assignee-type="member" class="flex h-[var(--issue-row-height)] items-center gap-2 bg-issue-row-selected px-[var(--issue-row-padding-x,1rem)] text-body"><div class="relative flex h-4 w-4 shrink-0 items-center justify-center"><input type="checkbox" checked class="absolute inset-0 accent-primary"></div>- <div class="flex min-w-0 flex-1 items-center gap-2"><span class="min-w-16 shrink-0 text-caption text-issue-row-identifier">ACM-139</span><span class="flex min-w-0 flex-1 items-center gap-1.5"><span class="truncate">Retry failed webhook deliveries</span><span class="ml-1.5 inline-flex shrink-0 items-center gap-1"><span data-slot="label-chip" data-mc="label-chip" data-color="#0ea5e9" class="inline-flex min-w-0 items-center gap-1 rounded-label px-2 py-0.5 text-caption font-medium" style="background-color: #0ea5e9; color: #f9fafb"><span class="max-w-[12rem] truncate">Platform</span></span></span></span></div>+ <div class="flex min-w-0 flex-1 items-center gap-2"><span class="min-w-16 shrink-0 text-caption text-issue-row-identifier">ACM-139</span><span class="flex min-w-0 flex-1 items-center gap-1.5"><span class="truncate">Retry failed webhook deliveries</span><span class="inline-grid min-w-0 max-w-full max-w-[40%]"><span class="flex min-w-0 items-center gap-1 overflow-hidden"><span title="acme/app#412" class="inline-flex min-w-0 max-w-[140px] items-center gap-1 rounded-full bg-muted/60 px-1.5 py-0.5 text-micro text-muted-foreground tabular-nums"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="icon icon-git-pull-request-closed size-3 shrink-0 text-pr-closed dark:text-pr-closed-dark"><circle cx="6.25" cy="6" r="2.75"/><circle cx="17.75" cy="18" r="2.75"/><path d="M6.25 8.75v12.5M17.75 15.25V11M15.5 3.5 20 8M20 3.5 15.5 8"/></svg><span class="flex min-w-0"><span class="shrink-0">#412</span></span></span></span></span><span class="ml-1.5 inline-flex shrink-0 items-center gap-1"><span data-slot="label-chip" data-mc="label-chip" data-color="#0ea5e9" class="inline-flex min-w-0 items-center gap-1 rounded-label px-2 py-0.5 text-caption font-medium" style="background-color: #0ea5e9; color: #f9fafb"><span class="max-w-[12rem] truncate">Platform</span></span></span></span></div></div></div><div>@@ -109,7 +109,7 @@</div><div data-slot="issue-list-row" data-mc="issue-row" data-status="in_review" data-priority="low" data-assignee-type="agent" class="flex h-[var(--issue-row-height)] items-center gap-2 px-[var(--issue-row-padding-x,1rem)] text-body"><div class="relative flex h-4 w-4 shrink-0 items-center justify-center"><svg data-mc="priority-icon" viewBox="0 0 16 16" fill="currentColor" class="h-3.5 w-3.5 shrink-0 text-priority-low"><rect x="2" y="8" width="3.5" height="6" rx="1"/><rect x="6.25" y="5" width="3.5" height="9" rx="1" opacity="0.35"/><rect x="10.5" y="2" width="3.5" height="12" rx="1" opacity="0.35"/></svg></div>- <div class="flex min-w-0 flex-1 items-center gap-2"><span class="min-w-16 shrink-0 text-caption text-issue-row-identifier">ACM-133</span><span class="flex min-w-0 flex-1 items-center gap-1.5"><span class="truncate">Invite links that expire</span></span></div>+ <div class="flex min-w-0 flex-1 items-center gap-2"><span class="min-w-16 shrink-0 text-caption text-issue-row-identifier">ACM-133</span><span class="flex min-w-0 flex-1 items-center gap-1.5"><span class="truncate">Invite links that expire</span><span class="inline-grid min-w-0 max-w-full max-w-[40%]"><span class="flex min-w-0 items-center gap-1 overflow-hidden"><span title="acme/app#431" class="inline-flex min-w-0 max-w-[140px] items-center gap-1 rounded-full bg-muted/60 px-1.5 py-0.5 text-micro text-muted-foreground tabular-nums"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="icon icon-git-pull-request-arrow size-3 shrink-0 text-pr-open dark:text-pr-open-dark"><circle cx="6.25" cy="6" r="2.75"/><circle cx="17.75" cy="18" r="2.75"/><path d="M6.25 8.75v12.5M12.75 6h2.5a2.5 2.5 0 0 1 2.5 2.5v6.75M15 3.5L12.75 6 15 8.5"/></svg><span class="flex min-w-0"><span class="shrink-0">#431</span></span></span></span></span></span></div></div></div><div>@@ -119,7 +119,7 @@</div><div data-slot="issue-list-row" data-mc="issue-row" data-status="done" data-priority="medium" data-assignee-type="member" class="flex h-[var(--issue-row-height)] items-center gap-2 px-[var(--issue-row-padding-x,1rem)] text-body"><div class="relative flex h-4 w-4 shrink-0 items-center justify-center"><svg data-mc="priority-icon" viewBox="0 0 16 16" fill="currentColor" class="h-3.5 w-3.5 shrink-0 text-priority-medium"><rect x="2" y="8" width="3.5" height="6" rx="1"/><rect x="6.25" y="5" width="3.5" height="9" rx="1"/><rect x="10.5" y="2" width="3.5" height="12" rx="1" opacity="0.35"/></svg></div>- <div class="flex min-w-0 flex-1 items-center gap-2"><span class="min-w-16 shrink-0 text-caption text-issue-row-identifier">ACM-120</span><span class="flex min-w-0 flex-1 items-center gap-1.5"><span class="truncate">Single sign-on with Okta</span></span></div>+ <div class="flex min-w-0 flex-1 items-center gap-2"><span class="min-w-16 shrink-0 text-caption text-issue-row-identifier">ACM-120</span><span class="flex min-w-0 flex-1 items-center gap-1.5"><span class="truncate">Single sign-on with Okta</span><span class="inline-grid min-w-0 max-w-full max-w-[40%]"><span class="flex min-w-0 items-center gap-1 overflow-hidden"><span title="acme/app#398" class="inline-flex min-w-0 max-w-[140px] items-center gap-1 rounded-full bg-muted/60 px-1.5 py-0.5 text-micro text-muted-foreground tabular-nums"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="icon icon-git-merge size-3 shrink-0 text-pr-merged dark:text-pr-merged-dark"><circle cx="6.5" cy="5.75" r="2.75"/><circle cx="17.5" cy="17.25" r="2.75"/><path d="M6.5 8.5v12.75M6.5 8.5c0 4.8 3.45 8.75 8.25 8.75"/></svg><span class="flex min-w-0"><span class="shrink-0">#398</span></span></span></span></span></span></div></div></div></div>