Skip to content

πŸ™Œ OpenHands: AI-Driven Development

refactor(theme): separate base color from text-base typography (#17646)

🐾 smolpaws060badce5850
diff --git a/__tests__/themes/tailwind-text-base.test.ts b/__tests__/themes/tailwind-text-base.test.ts
new file mode 100644
index 0000000000..72b33eedac
--- /dev/null
+++ b/__tests__/themes/tailwind-text-base.test.ts
@@ -0,0 +1,38 @@
+import { readFile } from "node:fs/promises";
+import { resolve } from "node:path";
+import { beforeAll, describe, expect, it } from "vitest";
+import { compile } from "@tailwindcss/node";
+import { cn } from "#/utils/utils";
+
+let css: string;
+
+beforeAll(async () => {
+ const compiler = await compile(
+ await readFile(resolve("src/tailwind.css"), "utf8"),
+ { base: resolve("src"), onDependency: () => {} },
+ );
+ css = compiler.build(["text-base", "text-canvas-base", "bg-canvas-base"]);
+});
+
+describe("Canvas text-base theme contract", () => {
+ it("generates a font size independently of the base surface color", () => {
+ const rule = css.match(/\.text-base \{([^}]+)\}/)?.[1];
+ expect(rule).toContain("font-size:");
+ expect(rule).not.toMatch(/(?:^|\s)color:/);
+ expect(css).toMatch(
+ /\.text-canvas-base \{\s*color: var\(--oh-color-base\)/,
+ );
+ expect(css).toMatch(
+ /\.bg-canvas-base \{\s*background-color: var\(--oh-color-base\)/,
+ );
+ });
+
+ it("merges font sizes and Canvas text colors independently in either order", () => {
+ expect(cn("text-sm text-canvas-base", "text-base text-contrast")).toBe(
+ "text-base text-contrast",
+ );
+ expect(cn("text-contrast text-base", "text-canvas-base text-sm")).toBe(
+ "text-canvas-base text-sm",
+ );
+ });
+});
diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md
index c321a06334..60c84b8afa 100644
--- a/docs/DEVELOPMENT.md
+++ b/docs/DEVELOPMENT.md
@@ -2,6 +2,26 @@
This document is for contributors working on `agent-canvas` itself.
+## Base color and typography utilities
+
+`text-base` is the standard Tailwind font-size utility (1rem with its default
+line height). Canvas's base surface color uses the distinct `canvas-base` token:
+`bg-canvas-base` and `text-canvas-base` resolve to `--oh-color-base`. Text on a
+primary surface can use the existing `text-on-primary` alias.
+
+When updating custom components or an embedding host that uses Canvas's generated
+CSS, migrate `bg-base` to `bg-canvas-base` (including variants and opacity modifiers),
+and migrate any intentional color use of `text-base` to `text-canvas-base` or an
+appropriate semantic color. The old `--color-base` Tailwind alias is removed to
+prevent it from taking over `text-base`; other `*-base` color utilities must use
+`*-canvas-base` when generated by the host's Tailwind build. The runtime theme
+variable `--oh-color-base` and the separate `base-secondary` token are unchanged.
+
+Keep fixed-pixel input sizes explicit when required: replacing `text-[16px]` with
+`text-base` changes its behavior when the host root font size differs from 16px,
+and can introduce a default line height. Check computed styles and class merging
+when migrating typography.
+
## Recommended local workflow
`npm run dev` runs the full local stack (agent-server + automation backend via
diff --git a/package-lock.json b/package-lock.json
index be707a3578..2d4b1a8b62 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -72,6 +72,7 @@
"@shadcn/lint": "0.2.0",
"@stryker-mutator/core": "9.6.1",
"@stryker-mutator/vitest-runner": "9.6.1",
+ "@tailwindcss/node": "4.3.3",
"@tailwindcss/typography": "0.5.20",
"@tanstack/eslint-plugin-query": "5.103.1",
"@testing-library/dom": "10.4.2",
diff --git a/package.json b/package.json
index 3f1b566c61..685f4a6779 100644
--- a/package.json
+++ b/package.json
@@ -134,6 +134,7 @@
"@shadcn/lint": "0.2.0",
"@stryker-mutator/core": "9.6.1",
"@stryker-mutator/vitest-runner": "9.6.1",
+ "@tailwindcss/node": "4.3.3",
"@tailwindcss/typography": "0.5.20",
"@tanstack/eslint-plugin-query": "5.103.1",
"@testing-library/dom": "10.4.2",
diff --git a/src/components/features/alerts/alert-banner.tsx b/src/components/features/alerts/alert-banner.tsx
index 0c1a5e5552..4d2e1132c5 100644
--- a/src/components/features/alerts/alert-banner.tsx
+++ b/src/components/features/alerts/alert-banner.tsx
@@ -116,7 +116,7 @@ export function AlertBanner({
<div
data-testid="alert-banner"
className={cn(
- "bg-base border border-primary text-contrast p-4 rounded",
+ "bg-canvas-base border border-primary text-contrast p-4 rounded",
"flex flex-row items-center justify-between m-1",
currentPath === "/" && "mt-3 mr-3",
)}
@@ -133,7 +133,7 @@ export function AlertBanner({
data-testid="dismiss-button"
onClick={() => setDismissedAt(updatedAt)}
className={cn(
- "bg-base rounded-full w-5 h-5 flex items-center justify-center cursor-pointer",
+ "bg-canvas-base rounded-full w-5 h-5 flex items-center justify-center cursor-pointer",
)}
>
<CloseIcon />
diff --git a/src/components/features/automations/setup/automation-setup-panel.tsx b/src/components/features/automations/setup/automation-setup-panel.tsx
index 948d0ef058..2c13729955 100644
--- a/src/components/features/automations/setup/automation-setup-panel.tsx
+++ b/src/components/features/automations/setup/automation-setup-panel.tsx
@@ -1848,10 +1848,10 @@ export function AutomationSetupPanel({
: null}
<div
data-testid="automation-setup-panel"
- className="flex h-full min-h-0 flex-col bg-base"
+ className="flex h-full min-h-0 flex-col bg-canvas-base"
>
{showInlineHeader ? (
- <header className="flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-[var(--oh-border)] bg-base px-3">
+ <header className="flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-[var(--oh-border)] bg-canvas-base px-3">
<div className="flex min-w-0 items-center gap-2">
<h2 className="min-w-0 truncate text-sm font-medium text-content">
{name.trim() || t(I18nKey.AUTOMATION_SETUP$TITLE)}
diff --git a/src/components/features/backends/api-key-entry-screen.tsx b/src/components/features/backends/api-key-entry-screen.tsx
index c6c0cc7c13..cc346fb270 100644
--- a/src/components/features/backends/api-key-entry-screen.tsx
+++ b/src/components/features/backends/api-key-entry-screen.tsx
@@ -83,7 +83,7 @@ export default function ApiKeyEntryScreen() {
return (
<div
data-testid="api-key-entry-screen"
- className="flex min-h-screen items-center justify-center bg-base px-6"
+ className="flex min-h-screen items-center justify-center bg-canvas-base px-6"
>
<div
className={cn(
diff --git a/src/components/features/backends/cloud-organization-boundary.tsx b/src/components/features/backends/cloud-organization-boundary.tsx
index 24527cb061..bf28e8c519 100644
--- a/src/components/features/backends/cloud-organization-boundary.tsx
+++ b/src/components/features/backends/cloud-organization-boundary.tsx
@@ -63,7 +63,7 @@ export function CloudOrganizationBoundary({
return <CloudOrganizationRecovery entry={entry} />;
}
return (
- <div className="min-h-full flex items-center justify-center bg-base">
+ <div className="min-h-full flex items-center justify-center bg-canvas-base">
<LoadingSpinner size="large" />
</div>
);
@@ -77,7 +77,7 @@ function CloudOrganizationRecovery({
const { t } = useTranslation("openhands");
const { active, backends, setActive } = useActiveBackendContext();
return (
- <div className="min-h-full flex flex-col items-center justify-center gap-4 bg-base px-6 text-contrast">
+ <div className="min-h-full flex flex-col items-center justify-center gap-4 bg-canvas-base px-6 text-contrast">
<p role="alert">
{t(
entry.isError
@@ -97,7 +97,7 @@ function CloudOrganizationRecovery({
aria-label={t(I18nKey.BACKEND$CHOOSER_TITLE)}
value={active.backend.id}
onChange={(event) => setActive(event.target.value, null)}
- className="rounded border border-border bg-base px-3 py-2"
+ className="rounded border border-border bg-canvas-base px-3 py-2"
>
{backends.map((backend) => (
<option key={backend.id} value={backend.id}>
@@ -125,7 +125,7 @@ function SuspendedOrganizationScreen({
const suspendedOrg = orgs.find((org) => org.id === active.orgId);
const otherOrgs = orgs.filter((org) => org.id !== active.orgId);
return (
- <div className="min-h-full flex flex-col items-center justify-center gap-4 bg-base px-6 text-contrast">
+ <div className="min-h-full flex flex-col items-center justify-center gap-4 bg-canvas-base px-6 text-contrast">
<p role="alert" className="max-w-md text-center">
{t(
suspension === "organization"
diff --git a/src/components/features/chat/components/chat-input-field.tsx b/src/components/features/chat/components/chat-input-field.tsx
index fecf06d1b0..e7500ea434 100644
--- a/src/components/features/chat/components/chat-input-field.tsx
+++ b/src/components/features/chat/components/chat-input-field.tsx
@@ -52,7 +52,7 @@ export function ChatInputField({
className="box-border content-stretch flex flex-row items-center justify-start min-h-6 p-0 relative shrink-0 flex-1"
data-name="Text & caret"
>
- {/* `text-base` is a color utility in this theme (--color-base), not 16px. */}
+ {/* Keep a fixed 16px input size; text-base scales with the host root font size. */}
{/* eslint-disable-next-line shadcn/no-arbitrary-values */}
<div className="basis-0 flex flex-col font-normal grow justify-center leading-[0] min-h-px min-w-px overflow-ellipsis overflow-hidden relative shrink-0 text-text-tertiary text-[16px] text-left">
<div
diff --git a/src/components/features/conversation-panel/conversation-status-dot.tsx b/src/components/features/conversation-panel/conversation-status-dot.tsx
index 42aa8f7c70..a709cc6a08 100644
--- a/src/components/features/conversation-panel/conversation-status-dot.tsx
+++ b/src/components/features/conversation-panel/conversation-status-dot.tsx
@@ -158,7 +158,7 @@ export function ConversationStatusDot({
content={label}
placement="right"
showArrow
- tooltipClassName="bg-base text-contrast text-xs shadow-lg"
+ tooltipClassName="bg-canvas-base text-contrast text-xs shadow-lg"
>
{dot}
</StyledTooltip>
diff --git a/src/components/features/conversation-panel/hook-matcher-content.tsx b/src/components/features/conversation-panel/hook-matcher-content.tsx
index 305193821c..c7dc5d98ad 100644
--- a/src/components/features/conversation-panel/hook-matcher-content.tsx
+++ b/src/components/features/conversation-panel/hook-matcher-content.tsx
@@ -47,7 +47,7 @@ export function HookMatcherContent({ matcher }: HookMatcherContentProps) {
borderRadius="medium"
maxHeight="small"
overflow="auto"
- className="border border-border bg-base text-text-tertiary"
+ className="border border-border bg-canvas-base text-text-tertiary"
>
{text}
</Pre>
diff --git a/src/components/features/conversation-panel/skill-content.tsx b/src/components/features/conversation-panel/skill-content.tsx
index 57ecb4ca48..00bccef6df 100644
--- a/src/components/features/conversation-panel/skill-content.tsx
+++ b/src/components/features/conversation-panel/skill-content.tsx
@@ -23,7 +23,7 @@ export function SkillContent({ content }: SkillContentProps) {
borderRadius="medium"
maxHeight="small"
overflow="auto"
- className="mt-2 border border-border bg-base text-text-tertiary"
+ className="mt-2 border border-border bg-canvas-base text-text-tertiary"
>
{content || t(I18nKey.SKILLS_MODAL$NO_CONTENT)}
</Pre>
diff --git a/src/components/features/conversation-panel/system-message-modal/tool-parameters.tsx b/src/components/features/conversation-panel/system-message-modal/tool-parameters.tsx
index a732361dfd..4c8134823c 100644
--- a/src/components/features/conversation-panel/system-message-modal/tool-parameters.tsx
+++ b/src/components/features/conversation-panel/system-message-modal/tool-parameters.tsx
@@ -16,7 +16,7 @@ export function ToolParameters({ parameters }: ToolParametersProps) {
<Typography.Text className="text-sm font-semibold text-text-tertiary">
{t(I18nKey.SYSTEM_MESSAGE_MODAL$PARAMETERS)}
</Typography.Text>
- <div className="text-sm mt-2 p-3 bg-base rounded-md overflow-auto text-text-tertiary max-h-100 border border-border">
+ <div className="text-sm mt-2 p-3 bg-canvas-base rounded-md overflow-auto text-text-tertiary max-h-100 border border-border">
<ReactJsonView name={false} src={parameters} theme={JSON_VIEW_THEME} />
</div>
</div>
diff --git a/src/components/features/conversation/conversation-main/conversation-main.tsx b/src/components/features/conversation/conversation-main/conversation-main.tsx
index 616ae23dd7..ae4601a8c0 100644
--- a/src/components/features/conversation/conversation-main/conversation-main.tsx
+++ b/src/components/features/conversation/conversation-main/conversation-main.tsx
@@ -163,7 +163,7 @@ export function ConversationMain() {
<header
data-testid="automation-setup-topbar"
className={cn(
- "flex shrink-0 border-b border-[var(--oh-border)] bg-base",
+ "flex shrink-0 border-b border-[var(--oh-border)] bg-canvas-base",
isMobile
? "flex-col"
: "h-10 min-h-10 items-center justify-between gap-2 px-3",
@@ -274,7 +274,7 @@ export function ConversationMain() {
<div
data-testid="conversation-chat-panel"
className={cn(
- "flex flex-col bg-base overflow-hidden",
+ "flex flex-col bg-canvas-base overflow-hidden",
isMobile
? cn("flex-1", showMobileAutomationForm && "hidden")
: cn(
diff --git a/src/components/features/diff-viewer/file-diff-viewer.tsx b/src/components/features/diff-viewer/file-diff-viewer.tsx
index c4805b26c5..d7334fea43 100644
--- a/src/components/features/diff-viewer/file-diff-viewer.tsx
+++ b/src/components/features/diff-viewer/file-diff-viewer.tsx
@@ -315,7 +315,7 @@ export function FileDiffViewer({
return (
<div
className={cn(
- "w-full border-b border-border overflow-auto p-4 bg-base prose max-w-none",
+ "w-full border-b border-border overflow-auto p-4 bg-canvas-base prose max-w-none",
!isLightTheme && "prose-invert",
)}
data-testid="markdown-preview"
@@ -412,7 +412,7 @@ export function FileDiffViewer({
{isDeleted && !commit ? (
<div
data-testid="file-deleted-message"
- className="w-full border-b border-border p-4 bg-base text-text-dim text-sm"
+ className="w-full border-b border-border p-4 bg-canvas-base text-text-dim text-sm"
>
{t(I18nKey.DIFF_VIEWER$FILE_DELETED)}
</div>
diff --git a/src/components/features/files-tab/workspace-file-discovery-settings.tsx b/src/components/features/files-tab/workspace-file-discovery-settings.tsx
index 0ffd19f1c7..569c863c4c 100644
--- a/src/components/features/files-tab/workspace-file-discovery-settings.tsx
+++ b/src/components/features/files-tab/workspace-file-discovery-settings.tsx
@@ -82,7 +82,7 @@ function DiscoveryForm({
onChange={(event) => setPatterns(event.target.value)}
rows={5}
disabled={isSaving}
- className="rounded-md border border-border bg-base px-3 py-2 font-mono"
+ className="rounded-md border border-border bg-canvas-base px-3 py-2 font-mono"
/>
<span className="text-xs text-muted">
{t(I18nKey.FILES$DISCOVERY_PATTERN_HELP)}
@@ -99,7 +99,7 @@ function DiscoveryForm({
value={limit}
disabled={isSaving}
onChange={(event) => setLimit(event.target.value)}
- className="rounded-md border border-border bg-base px-3 py-2"
+ className="rounded-md border border-border bg-canvas-base px-3 py-2"
/>
</label>
<label className="flex items-center gap-2 text-sm">
diff --git a/src/components/features/onboarding/steps/say-hello-step.tsx b/src/components/features/onboarding/steps/say-hello-step.tsx
index d66fe62688..f1b8ceedcb 100644
--- a/src/components/features/onboarding/steps/say-hello-step.tsx
+++ b/src/components/features/onboarding/steps/say-hello-step.tsx
@@ -111,7 +111,7 @@ export function SayHelloStep({
}}
placeholder={defaultMessage}
disabled={isLaunching}
- // `text-base` is a color utility in this theme (--color-base), not 16px.
+ // Keep a fixed 16px input size; text-base scales with the host root font size.
// eslint-disable-next-line shadcn/no-arbitrary-values
className="min-h-5 w-full flex-1 bg-transparent text-[16px] font-normal leading-5 text-contrast outline-none placeholder:text-text-tertiary disabled:cursor-not-allowed disabled:opacity-50"
/>
diff --git a/src/components/features/settings/settings-switch.tsx b/src/components/features/settings/settings-switch.tsx
index a3b3ea48f5..93e63696ac 100644
--- a/src/components/features/settings/settings-switch.tsx
+++ b/src/components/features/settings/settings-switch.tsx
@@ -57,7 +57,7 @@ export function SettingsSwitch({
<div className="flex items-center gap-1">
<span className="text-sm">{children}</span>
{isBeta && (
- <span className="text-[11px] leading-4 text-base font-[500] tracking-tighter bg-primary px-1 rounded-full">
+ <span className="text-[11px] leading-4 text-on-primary font-[500] tracking-tighter bg-primary px-1 rounded-full">
{t(I18nKey.BADGE$BETA)}
</span>
)}
diff --git a/src/components/features/settings/upgrade-banner.tsx b/src/components/features/settings/upgrade-banner.tsx
index 475ee6aa8e..2e01263c5f 100644
--- a/src/components/features/settings/upgrade-banner.tsx
+++ b/src/components/features/settings/upgrade-banner.tsx
@@ -18,7 +18,7 @@ export function UpgradeBanner({
return (
<div
className={cn(
- "bg-primary text-base flex items-center justify-center gap-3 p-2 w-full rounded",
+ "bg-primary text-on-primary flex items-center justify-center gap-3 p-2 w-full rounded",
className,
)}
data-testid="upgrade-banner"
diff --git a/src/components/features/sidebar/sidebar.tsx b/src/components/features/sidebar/sidebar.tsx
index 1e1b8f319b..7c0c898f58 100644
--- a/src/components/features/sidebar/sidebar.tsx
+++ b/src/components/features/sidebar/sidebar.tsx
@@ -207,7 +207,7 @@ export function Sidebar() {
setCollapsedRailHovered(false);
}}
className={cn(
- "max-md:hidden flex bg-base flex-col min-h-0 transition-[width,min-width] duration-200",
+ "max-md:hidden flex bg-canvas-base flex-col min-h-0 transition-[width,min-width] duration-200",
"md:border-r md:border-border md:h-full",
collapsed
? "md:w-15 md:min-w-15 md:px-2.5"
@@ -241,7 +241,7 @@ export function Sidebar() {
data-testid="sidebar-mobile-drawer"
aria-hidden={!mobileDrawerVisible}
className={cn(
- "fixed inset-y-0 left-0 z-50 flex min-h-0 w-[min(300px,85vw)] flex-col bg-base",
+ "fixed inset-y-0 left-0 z-50 flex min-h-0 w-[min(300px,85vw)] flex-col bg-canvas-base",
"border-r border-border pb-2 pl-2.5 pr-0 md:hidden",
"transition-transform ease-in-out motion-reduce:transition-none",
mobileDrawerVisible ? "translate-x-0" : "-translate-x-full",
diff --git a/src/components/shared/action-tooltip.tsx b/src/components/shared/action-tooltip.tsx
index e380480ff6..820b12a5c7 100644
--- a/src/components/shared/action-tooltip.tsx
+++ b/src/components/shared/action-tooltip.tsx
@@ -35,7 +35,7 @@ export function ActionTooltip({ type, onClick }: ActionTooltipProps) {
"rounded px-2 h-6.5 text-sm font-normal leading-5 cursor-pointer hover:opacity-80",
type === "confirm"
? "bg-tertiary text-contrast"
- : "bg-contrast text-base",
+ : "bg-contrast text-canvas-base",
)}
onClick={onClick}
>
diff --git a/src/root.tsx b/src/root.tsx
index 72e0075489..bd5d0fd96f 100644
--- a/src/root.tsx
+++ b/src/root.tsx
@@ -118,9 +118,9 @@ export function Layout({ children }: { children: React.ReactNode }) {
function AgentServerBootstrapLoading() {
return (
- <main className="min-h-screen bg-base px-6 py-10 text-contrast">
+ <main className="min-h-screen bg-canvas-base px-6 py-10 text-contrast">
<div className="mx-auto flex min-h-screen max-w-6xl items-center justify-center">
- <div className="rounded-3xl border border-contrast/10 bg-base/80 px-8 py-10 shadow-2xl">
+ <div className="rounded-3xl border border-contrast/10 bg-canvas-base/80 px-8 py-10 shadow-2xl">
<LoadingSpinner size="large" />
</div>
</div>
@@ -153,7 +153,7 @@ function MissingAgentServerScreen() {
return (
<main
data-testid="agent-server-onboarding-screen"
- className="min-h-screen bg-base"
+ className="min-h-screen bg-canvas-base"
>
<React.Suspense fallback={null}>
<ManageBackendsModal onClose={handleClose} recoveryMode />
@@ -189,7 +189,7 @@ function FirstRunOnboardingScreen({ onClose }: { onClose: () => void }) {
return (
<main
data-testid="first-run-onboarding-screen"
- className="min-h-screen bg-base"
+ className="min-h-screen bg-canvas-base"
>
<React.Suspense fallback={<AgentServerBootstrapLoading />}>
<BackendFormModal
@@ -206,7 +206,7 @@ function FirstRunOnboardingScreen({ onClose }: { onClose: () => void }) {
return (
<main
data-testid="first-run-onboarding-screen"
- className="min-h-screen bg-base"
+ className="min-h-screen bg-canvas-base"
>
<NavigationProvider value={navigationValue}>
<React.Suspense fallback={<AgentServerBootstrapLoading />}>
diff --git a/src/routes/automation-setup-new.tsx b/src/routes/automation-setup-new.tsx
index eb4de48133..035cf0f2e8 100644
--- a/src/routes/automation-setup-new.tsx
+++ b/src/routes/automation-setup-new.tsx
@@ -103,10 +103,10 @@ export default function AutomationSetupNew() {
: null;
return (
- <div className="flex h-full min-h-0 flex-col overflow-hidden bg-base">
+ <div className="flex h-full min-h-0 flex-col overflow-hidden bg-canvas-base">
<header
data-testid="automation-setup-topbar"
- className="flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-[var(--oh-border)] bg-base px-3"
+ className="flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-[var(--oh-border)] bg-canvas-base px-3"
>
<h2 className="min-w-0 truncate text-sm font-medium text-content">
{title}
diff --git a/src/routes/device-verify.tsx b/src/routes/device-verify.tsx
index f82afc18d6..2765e4f576 100644
--- a/src/routes/device-verify.tsx
+++ b/src/routes/device-verify.tsx
@@ -146,7 +146,7 @@ export default function DeviceVerify() {
<H1 className="text-2xl mb-4 text-center">
{t(I18nKey.DEVICE$AUTHORIZATION_REQUEST)}
</H1>
- <div className="mb-6 p-4 bg-base rounded-lg border border-border-subtle">
+ <div className="mb-6 p-4 bg-canvas-base rounded-lg border border-border-subtle">
<p className="text-xs text-text-subtle mb-2 text-center uppercase tracking-wider">
{t(I18nKey.DEVICE$CODE_LABEL)}
</p>
diff --git a/src/routes/root-layout.tsx b/src/routes/root-layout.tsx
index 236c352b34..cb1470face 100644
--- a/src/routes/root-layout.tsx
+++ b/src/routes/root-layout.tsx
@@ -146,7 +146,7 @@ function MainAppContent() {
if (config.isLoading) {
return (
- <div className="min-h-screen flex items-center justify-center bg-base">
+ <div className="min-h-screen flex items-center justify-center bg-canvas-base">
<TitleBarDragRegion />
<LoadingSpinner size="large" />
</div>
@@ -167,7 +167,7 @@ function MainAppContent() {
<div
data-testid="root-layout"
className={cn(
- "h-screen lg:min-w-5xl flex flex-col md:flex-row bg-base overflow-hidden p-0",
+ "h-screen lg:min-w-5xl flex flex-col md:flex-row bg-canvas-base overflow-hidden p-0",
showTitleBarBand && "pt-7",
)}
>
diff --git a/src/routes/shared-conversation.tsx b/src/routes/shared-conversation.tsx
index f09c98d1bc..3c04b8c368 100644
--- a/src/routes/shared-conversation.tsx
+++ b/src/routes/shared-conversation.tsx
@@ -75,7 +75,7 @@ export default function SharedConversation() {
if (isLoading) {
return (
- <div className="flex items-center justify-center h-screen bg-base">
+ <div className="flex items-center justify-center h-screen bg-canvas-base">
<LoadingSpinner size="large" />
</div>
);
@@ -83,14 +83,14 @@ export default function SharedConversation() {
if (error || !conversation) {
return (
- <div className="flex items-center justify-center h-screen bg-base">
+ <div className="flex items-center justify-center h-screen bg-canvas-base">
<div className="text-contrast">{t(I18nKey.CONVERSATION$NOT_FOUND)}</div>
</div>
);
}
return (
- <div className="h-screen bg-base text-contrast flex flex-col">
+ <div className="h-screen bg-canvas-base text-contrast flex flex-col">
{/* Header with logo, conversation title and branch info */}
<div className="border-b border-border-subtle p-4 flex-shrink-0">
<div className="max-w-4xl mx-auto flex items-start gap-4">
diff --git a/src/tailwind.css b/src/tailwind.css
index 361a72da03..c092ccde02 100644
--- a/src/tailwind.css
+++ b/src/tailwind.css
@@ -12,8 +12,8 @@
@theme inline {
--color-primary: var(--oh-color-primary);
--color-logo: var(--oh-color-logo);
- --color-base: var(--oh-color-base);
- /* Avoid text-base: tailwind-merge interprets it as a font size. */
+ --color-canvas-base: var(--oh-color-base);
+ /* Keep color names distinct from font sizes such as text-base. */
--color-on-primary: var(--oh-color-base);
--color-base-secondary: var(--oh-color-base-secondary);
--color-danger: var(--oh-color-danger);
diff --git a/src/ui/pre.tsx b/src/ui/pre.tsx
index 9fe3e2a150..58f9e34013 100644
--- a/src/ui/pre.tsx
+++ b/src/ui/pre.tsx
@@ -17,7 +17,7 @@ const preVariants = cva("whitespace-pre-wrap", {
},
background: {
default: "",
- dark: "bg-base",
+ dark: "bg-canvas-base",
},
textColor: {
default: "",
diff --git a/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts b/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
index 34cd07002e..1fc8a82256 100644
--- a/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
+++ b/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
@@ -15,7 +15,10 @@ import type { ActionEvent, MessageEvent } from "#/types/agent-server/core";
import { SecurityRisk } from "#/types/agent-server/core";
import type { FinishAction } from "#/types/agent-server/core/base/action";
import type { CriticResult } from "#/types/agent-server/core/base/critic";
-import { seedLocalStorage, routeSessionApiKey } from "../utils/mock-llm-helpers";
+import {
+ seedLocalStorage,
+ routeSessionApiKey,
+} from "../utils/mock-llm-helpers";
test.describe.configure({ mode: "serial" });
@@ -389,24 +392,28 @@ test.describe("UI regressions", () => {
)
.not.toBe("rgba(0, 0, 0, 0)");
- const insideBackground = await shell.evaluate(
- (el) => getComputedStyle(el).backgroundColor,
- );
-
- const outsideStyles = await page.evaluate(() => {
+ const probeStyles = await shell.evaluate((el) => {
+ const shellBackground = getComputedStyle(el).backgroundColor;
const probe = document.createElement("div");
- probe.className = "bg-base text-content-2";
- probe.textContent = "host";
+ probe.className = "bg-canvas-base";
+ // Keep the token available outside the shell: an undefined variable
+ // would make even a leaked utility transparent and hide a scoping bug.
+ probe.style.setProperty("--oh-color-base", shellBackground);
+ el.appendChild(probe);
+ const insideBackground = getComputedStyle(probe).backgroundColor;
document.documentElement.appendChild(probe);
- const styles = getComputedStyle(probe);
+ const outsideBackground = getComputedStyle(probe).backgroundColor;
+ probe.remove();
return {
- backgroundColor: styles.backgroundColor,
- color: styles.color,
+ shellBackground,
+ insideBackground,
+ outsideBackground,
};
});
- expect(insideBackground).not.toBe("rgba(0, 0, 0, 0)");
- expect(outsideStyles.backgroundColor).not.toBe(insideBackground);
+ // First prove the utility exists, then prove it cannot style the host.
+ expect(probeStyles.insideBackground).toBe(probeStyles.shellBackground);
+ expect(probeStyles.outsideBackground).toBe("rgba(0, 0, 0, 0)");
});
// ── critic result rendering ──────────────────────────────────────