Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(ui): deepen light accent tokens to clear WCAG AA (#1403)

Call White7fe4d19f48fc
diff --git a/ui/scripts/validate-theme.mjs b/ui/scripts/validate-theme.mjs
index 63b8fc514..304c311c3 100644
--- a/ui/scripts/validate-theme.mjs
+++ b/ui/scripts/validate-theme.mjs
@@ -164,6 +164,89 @@ assertEqual('system dark background', systemDark.get('--background'), '#080812')
assertEqual('system light color-scheme', systemLight.get('color-scheme'), 'light');
assertEqual('system dark color-scheme', systemDark.get('color-scheme'), 'dark');
+// An accent doubles as small status text — text-mint / text-gold / text-cyan /
+// text-destructive are used app-wide — and every X / X-foreground pair is a fill
+// plus the label printed on it. Both have to clear WCAG AA for small text, in
+// both themes. Light is the fragile side: the dark palette's vivid accents read
+// at 2.5-4.2:1 on a light surface, which is what this guard exists to catch.
+const AA_SMALL_TEXT = 4.5;
+
+function parseColor(value) {
+ const match = /^#([\da-f]{3}|[\da-f]{6})$/i.exec((value ?? '').trim());
+ if (!match) {
+ return null;
+ }
+
+ const hex = match[1].length === 3 ? [...match[1]].map((channel) => channel + channel).join('') : match[1];
+ return [0, 2, 4].map((offset) => Number.parseInt(hex.slice(offset, offset + 2), 16));
+}
+
+// A ratio only means something between two opaque colours. Anything else -- an
+// alpha channel, a var() indirection, a gradient, oklch() or color-mix() -- has
+// no single value to measure, so the guard must say so instead of skipping the
+// assertion it advertises.
+function requireMeasurableColor(name, prop, value) {
+ const rgb = parseColor(value);
+ if (!rgb) {
+ throw new Error(
+ `${name}: ${prop} is ${value ?? 'undefined'}, which carries no measurable contrast. `
+ + 'Guarded tokens must resolve to an opaque #rgb or #rrggbb value; a translucent or computed '
+ + 'colour depends on its backdrop, so AA cannot be asserted from the token alone. Give the '
+ + 'token an opaque value, or drop it from the guarded list and record why.',
+ );
+ }
+
+ return rgb;
+}
+
+function relativeLuminance(rgb) {
+ const [r, g, b] = rgb.map((channel) => {
+ const ratio = channel / 255;
+ return ratio <= 0.03928 ? ratio / 12.92 : ((ratio + 0.055) / 1.055) ** 2.4;
+ });
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
+}
+
+function contrastRatio(foreground, background) {
+ const [lighter, darker] = [relativeLuminance(foreground), relativeLuminance(background)]
+ .sort((a, b) => b - a);
+ return (lighter + 0.05) / (darker + 0.05);
+}
+
+function assertContrast(name, tokens, inkProp, surfaceProp) {
+ const ink = requireMeasurableColor(name, inkProp, tokens.get(inkProp));
+ const surface = requireMeasurableColor(name, surfaceProp, tokens.get(surfaceProp));
+
+ const ratio = contrastRatio(ink, surface);
+ if (ratio < AA_SMALL_TEXT) {
+ throw new Error(
+ `${name}: ${inkProp} on ${surfaceProp} is ${ratio.toFixed(2)}:1, below WCAG AA ${AA_SMALL_TEXT}:1`,
+ );
+ }
+}
+
+const INK_TOKENS = ['--foreground', '--muted', '--mint', '--cyan', '--violet', '--gold', '--pink', '--destructive'];
+const INK_SURFACES = ['--card', '--background', '--surface-3'];
+
+for (const [theme, tokens] of [['light', systemLight], ['dark', systemDark]]) {
+ for (const ink of INK_TOKENS) {
+ assertEqual(`${theme} ${ink} is defined`, tokens.has(ink), true);
+ for (const surface of INK_SURFACES) {
+ assertContrast(`${theme} ink`, tokens, ink, surface);
+ }
+ }
+
+ // Every fill that declares its own foreground is checked against it, so a
+ // deepened or lightened fill can never silently strand its label.
+ const pairs = [...tokens.keys()]
+ .filter((prop) => prop.endsWith('-foreground') && tokens.has(prop.slice(0, -'-foreground'.length)))
+ .map((prop) => [prop, prop.slice(0, -'-foreground'.length)]);
+ assertEqual(`${theme} fill pairs exist`, pairs.length > 0, true);
+ for (const [foreground, fill] of pairs) {
+ assertContrast(`${theme} fill`, tokens, foreground, fill);
+ }
+}
+
const modelHub = (options) => resolveThemeTokens({ ...options, source: modelHubCss });
const modelHubSystemDark = modelHub({ prefersLight: false, themeAttr: null });
const modelHubSystemLight = modelHub({ prefersLight: true, themeAttr: null });
diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsx
index b86c04426..c5b7de3f8 100644
--- a/ui/src/components/AppShell.tsx
+++ b/ui/src/components/AppShell.tsx
@@ -153,7 +153,7 @@ const MobileNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {
<Icon className="size-4" />
)}
{item.badge ? (
- <span className="absolute -right-2 -top-1.5 min-w-[14px] rounded-full bg-mint px-1 text-center font-mono text-[9px] font-bold leading-[14px] text-background">
+ <span className="absolute -right-2 -top-1.5 min-w-[14px] rounded-full bg-mint px-1 text-center font-mono text-[9px] font-bold leading-[14px] text-primary-foreground">
{item.badge > 99 ? '99+' : item.badge}
</span>
) : null}
diff --git a/ui/src/components/settings/SettingsPlatformsPage.tsx b/ui/src/components/settings/SettingsPlatformsPage.tsx
index 6c13eda1b..532aaa9bd 100644
--- a/ui/src/components/settings/SettingsPlatformsPage.tsx
+++ b/ui/src/components/settings/SettingsPlatformsPage.tsx
@@ -293,7 +293,7 @@ export const SettingsPlatformsPage: React.FC = () => {
)}
>
{active && (
- <span className="absolute right-1.5 top-1.5 inline-flex size-4 items-center justify-center rounded-full bg-mint text-background">
+ <span className="absolute right-1.5 top-1.5 inline-flex size-4 items-center justify-center rounded-full bg-mint text-primary-foreground">
{busy ? <Loader2 size={10} className="animate-spin" /> : <Check size={11} strokeWidth={3} />}
</span>
)}
diff --git a/ui/src/components/steps/PlatformSelection.tsx b/ui/src/components/steps/PlatformSelection.tsx
index 6e0345434..d581a3eea 100644
--- a/ui/src/components/steps/PlatformSelection.tsx
+++ b/ui/src/components/steps/PlatformSelection.tsx
@@ -418,7 +418,7 @@ export const PlatformSelection: React.FC<PlatformSelectionProps> = ({ data, onNe
className={clsx(
'flex size-4 shrink-0 items-center justify-center rounded-full border text-[9px] font-semibold',
index < 2 || currentValidationState === 'success'
- ? 'border-mint bg-mint text-background'
+ ? 'border-mint bg-mint text-primary-foreground'
: 'border-border bg-background text-muted'
)}
>
diff --git a/ui/src/components/ui/checkbox.tsx b/ui/src/components/ui/checkbox.tsx
index b018b5d8a..6b8ed8a15 100644
--- a/ui/src/components/ui/checkbox.tsx
+++ b/ui/src/components/ui/checkbox.tsx
@@ -25,7 +25,7 @@ export interface CheckboxProps {
export function Checkbox({ checked, onCheckedChange, disabled, label, className, presentational }: CheckboxProps) {
const visual = clsx(
'flex size-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors',
- checked ? 'border-transparent bg-mint text-[#06060e]' : 'border-border-strong bg-surface-3 text-transparent',
+ checked ? 'border-transparent bg-mint text-primary-foreground' : 'border-border-strong bg-surface-3 text-transparent',
disabled && 'cursor-not-allowed opacity-50',
className,
);
diff --git a/ui/src/components/ui/directory-browser.tsx b/ui/src/components/ui/directory-browser.tsx
index aebd7e9e0..b479828b1 100644
--- a/ui/src/components/ui/directory-browser.tsx
+++ b/ui/src/components/ui/directory-browser.tsx
@@ -601,7 +601,7 @@ export const DirectoryBrowser: React.FC<DirectoryBrowserProps> = ({
className={clsx(
'rounded-md px-2.5 py-0.5 text-[11px] font-semibold transition',
newFolderName.trim()
- ? 'bg-mint text-[#080812] hover:brightness-110'
+ ? 'bg-mint text-primary-foreground hover:brightness-110'
: 'bg-muted-soft text-muted',
)}
>
@@ -642,7 +642,7 @@ export const DirectoryBrowser: React.FC<DirectoryBrowserProps> = ({
className={clsx(
'flex items-center gap-1.5 rounded-md px-4 py-1.5 text-[12px] font-semibold transition',
canConfirm
- ? 'bg-mint text-[#080812] shadow-[0_0_14px_-4px_rgba(91,255,160,0.6)] hover:brightness-110'
+ ? 'bg-mint text-primary-foreground shadow-[0_0_14px_-4px_rgba(91,255,160,0.6)] hover:brightness-110'
: 'cursor-not-allowed bg-muted-soft text-muted',
)}
>
diff --git a/ui/src/components/ui/vault-protected-unlock.tsx b/ui/src/components/ui/vault-protected-unlock.tsx
index 5577d8fac..34160d735 100644
--- a/ui/src/components/ui/vault-protected-unlock.tsx
+++ b/ui/src/components/ui/vault-protected-unlock.tsx
@@ -128,7 +128,7 @@ export const VaultProtectedUnlock: React.FC<{ vault: Vault; secretName?: string;
{canUsePasskey ? (
<div className="flex flex-col items-center gap-2.5 rounded-xl border-[1.5px] border-mint bg-mint-soft p-4">
- <Badge variant="success" className="border-transparent bg-mint uppercase tracking-wide text-background">
+ <Badge variant="success" className="border-transparent bg-mint uppercase tracking-wide text-primary-foreground">
<Sparkles className="size-3" />
{t('vaults.protectedUnlock.recommended')}
</Badge>
diff --git a/ui/src/components/workbench/EditorApp.tsx b/ui/src/components/workbench/EditorApp.tsx
index e95c03249..55e007b17 100644
--- a/ui/src/components/workbench/EditorApp.tsx
+++ b/ui/src/components/workbench/EditorApp.tsx
@@ -849,7 +849,7 @@ export const EditorApp: React.FC<{
the left, but we have no real git/diagnostics data for an arbitrary folder — showing a
hardcoded "master · 0 ⚠ 0" would be misleading, so those are omitted until wired. The
right side (cursor / indentation / language) is real. */}
- <div className="flex items-center gap-3.5 bg-cyan px-3.5 py-1 font-mono text-[10.5px] font-semibold text-[#06222B]">
+ <div className="flex items-center gap-3.5 bg-cyan px-3.5 py-1 font-mono text-[10.5px] font-semibold text-accent-foreground">
{active && activeTab?.kind === 'preview' ? (
<span className="ml-auto truncate">{t('preview.title')}</span>
) : active ? (
diff --git a/ui/src/components/workbench/InboxPage.tsx b/ui/src/components/workbench/InboxPage.tsx
index 20ea2e597..817e8240d 100644
--- a/ui/src/components/workbench/InboxPage.tsx
+++ b/ui/src/components/workbench/InboxPage.tsx
@@ -287,7 +287,7 @@ export const InboxPage: React.FC = () => {
className="inline-flex items-center gap-1.5 rounded-md border border-mint/30 bg-mint/[0.06] px-3 py-1.5 text-[11px] font-semibold text-mint transition hover:bg-mint/[0.12]"
>
{unread > 0 && (
- <span className="inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-mint px-1.5 font-mono text-[9px] font-bold text-[#080812]">
+ <span className="inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-mint px-1.5 font-mono text-[9px] font-bold text-primary-foreground">
{unread > 99 ? '99+' : unread}
</span>
)}
diff --git a/ui/src/components/workbench/NewAgentDialog.tsx b/ui/src/components/workbench/NewAgentDialog.tsx
index 2231339a8..bbe485cce 100644
--- a/ui/src/components/workbench/NewAgentDialog.tsx
+++ b/ui/src/components/workbench/NewAgentDialog.tsx
@@ -341,7 +341,7 @@ export const NewAgentDialog: React.FC<NewAgentDialogProps> = ({ open, onClose, o
className={clsx(
'inline-flex items-center gap-1.5 rounded-md px-4 py-1.5 text-[12px] font-bold transition',
canSubmit
- ? 'bg-mint text-[#080812] shadow-[0_0_14px_-4px_rgba(91,255,160,0.6)] hover:brightness-110'
+ ? 'bg-mint text-primary-foreground shadow-[0_0_14px_-4px_rgba(91,255,160,0.6)] hover:brightness-110'
: 'cursor-not-allowed bg-muted-soft text-muted',
)}
>
diff --git a/ui/src/components/workbench/ProjectsPage.tsx b/ui/src/components/workbench/ProjectsPage.tsx
index 55f698482..0993219c2 100644
--- a/ui/src/components/workbench/ProjectsPage.tsx
+++ b/ui/src/components/workbench/ProjectsPage.tsx
@@ -340,7 +340,7 @@ const MobileSessionRow: React.FC<{
</span>
<SessionPinIndicator pinned={session.pinned} label={t('workbench.sessionPinned')} />
{unread > 0 ? (
- <span className="shrink-0 rounded-full bg-mint px-1.5 py-0.5 font-mono text-[10px] font-bold text-background">
+ <span className="shrink-0 rounded-full bg-mint px-1.5 py-0.5 font-mono text-[10px] font-bold text-primary-foreground">
{unread > 99 ? '99+' : unread}
</span>
) : (
diff --git a/ui/src/components/workbench/WorkbenchSidebar.tsx b/ui/src/components/workbench/WorkbenchSidebar.tsx
index cad8fe6af..12c7ba487 100644
--- a/ui/src/components/workbench/WorkbenchSidebar.tsx
+++ b/ui/src/components/workbench/WorkbenchSidebar.tsx
@@ -336,7 +336,7 @@ const SessionRow: React.FC<{
{displayName}
</span>
{unread > 0 && (
- <span className="inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-mint px-1.5 font-mono text-[9px] font-bold text-[#080812]">
+ <span className="inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-mint px-1.5 font-mono text-[9px] font-bold text-primary-foreground">
{unread > 99 ? '99+' : unread}
</span>
)}
@@ -786,7 +786,7 @@ export const WorkbenchSidebar: React.FC<{ onOpenSearch?: () => void }> = ({ onOp
<Inbox className={clsx('size-4', isActive ? 'text-cyan' : 'text-foreground')} />
<span className="flex-1">{t('workbench.nav.inbox')}</span>
{badge && (
- <span className="inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-cyan px-1.5 py-0.5 font-mono text-[9px] font-bold text-[#080812] shadow-[0_0_10px_-2px_rgba(63,224,229,0.7)]">
+ <span className="inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-cyan px-1.5 py-0.5 font-mono text-[9px] font-bold text-accent-foreground shadow-[0_0_10px_-2px_rgba(63,224,229,0.7)]">
{badge}
</span>
)}
diff --git a/ui/src/components/workbench/skills/AddSkillDialog.tsx b/ui/src/components/workbench/skills/AddSkillDialog.tsx
index f78710868..99c610eef 100644
--- a/ui/src/components/workbench/skills/AddSkillDialog.tsx
+++ b/ui/src/components/workbench/skills/AddSkillDialog.tsx
@@ -325,7 +325,7 @@ export function AddSkillDialog({ defaultScope, projectId, projectName, onClose,
type="button"
onClick={install}
disabled={!discovered || selected.size === 0 || backends.size === 0 || busy === 'install'}
- className="flex items-center gap-1.5 rounded-lg bg-mint px-4 py-2 text-[12px] font-semibold text-[#080812] shadow-[0_4px_16px_-4px_rgba(91,255,160,0.5)] transition hover:brightness-110 disabled:opacity-50"
+ className="flex items-center gap-1.5 rounded-lg bg-mint px-4 py-2 text-[12px] font-semibold text-primary-foreground shadow-[0_4px_16px_-4px_rgba(91,255,160,0.5)] transition hover:brightness-110 disabled:opacity-50"
>
{busy === 'install' ? <Loader2 className="size-3.5 animate-spin" /> : <Download className="size-3.5" />}
{busy === 'install' ? t('skills.addDialog.installing') : t('skills.addDialog.install', { count: selected.size })}
diff --git a/ui/src/index.css b/ui/src/index.css
index bf4aa83e3..db22c6c8a 100644
--- a/ui/src/index.css
+++ b/ui/src/index.css
@@ -122,7 +122,9 @@
--mint-soft: rgba(91, 255, 160, 0.16);
--cyan: #3fe0e5;
--cyan-soft: rgba(63, 224, 229, 0.16);
- --violet: #7c5bff;
+ /* Lightened just past AA on --card: #7c5bff read at 4.28:1 there, the one dark
+ ink below the floor. Hue and saturation are unchanged. */
+ --violet: #8465ff;
--violet-soft: rgba(124, 91, 255, 0.16);
--gold: #ffc857;
--gold-foreground: #080812;
@@ -176,31 +178,40 @@
--popover: #ffffff;
--popover-foreground: #0a0a14;
- --primary: #10b981;
+ /* Light inks are deepened relative to dark. The dark palette's vivid accents
+ read at 2.5-4.2:1 as small text on a light surface, and text-mint /
+ text-gold / text-cyan / text-destructive are used app-wide, so every ink
+ here clears WCAG AA (4.5:1) against --surface-3, the darkest light
+ surface. Deepening the fills lifts white-on-fill for --primary /
+ --accent / --gold / --destructive by the same amount, since contrast is
+ symmetric. --primary / --accent / --ring carry --mint / --cyan by
+ definition. Guarded by ui/scripts/validate-theme.mjs. */
+ --primary: #067a55;
--primary-foreground: #ffffff;
--secondary: #eef1f7;
--secondary-foreground: #0a0a14;
--muted: #5c6079;
--muted-soft: #eef1f7;
- --accent: #0891b2;
+ --accent: #0e7490;
--accent-foreground: #ffffff;
- --destructive: #e11d48;
+ --destructive: #ca1a41;
--destructive-foreground: #ffffff;
--border: rgba(8, 8, 18, 0.08);
--border-strong: rgba(8, 8, 18, 0.14);
--input: rgba(8, 8, 18, 0.12);
- --ring: rgba(16, 185, 129, 0.5);
+ --ring: rgba(6, 122, 85, 0.5);
- --mint: #10b981;
+ /* Accents share the AA floor below - see the --primary group. */
+ --mint: #067a55;
--mint-soft: rgba(16, 185, 129, 0.14);
- --cyan: #0891b2;
+ --cyan: #0e7490;
--cyan-soft: rgba(8, 145, 178, 0.14);
--violet: #7c3aed;
--violet-soft: rgba(124, 58, 237, 0.14);
- --gold: #d97706;
+ --gold: #ae4f08;
--gold-foreground: #ffffff;
- --pink: #dc2659;
+ --pink: #c7204f;
--pink-soft: rgba(220, 38, 89, 0.10);
/* Light-theme page gradients (softer alphas over light base). */
@@ -253,31 +264,32 @@
--popover: #ffffff;
--popover-foreground: #0a0a14;
- --primary: #10b981;
+ --primary: #067a55;
--primary-foreground: #ffffff;
--secondary: #eef1f7;
--secondary-foreground: #0a0a14;
--muted: #5c6079;
--muted-soft: #eef1f7;
- --accent: #0891b2;
+ --accent: #0e7490;
--accent-foreground: #ffffff;
- --destructive: #e11d48;
+ --destructive: #ca1a41;
--destructive-foreground: #ffffff;
--border: rgba(8, 8, 18, 0.08);
--border-strong: rgba(8, 8, 18, 0.14);
--input: rgba(8, 8, 18, 0.12);
- --ring: rgba(16, 185, 129, 0.5);
+ --ring: rgba(6, 122, 85, 0.5);
- --mint: #10b981;
+ /* Deepened inks, AA on --surface-3 - see the prefers-color-scheme block above. */
+ --mint: #067a55;
--mint-soft: rgba(16, 185, 129, 0.14);
- --cyan: #0891b2;
+ --cyan: #0e7490;
--cyan-soft: rgba(8, 145, 178, 0.14);
--violet: #7c3aed;
--violet-soft: rgba(124, 58, 237, 0.14);
- --gold: #d97706;
+ --gold: #ae4f08;
--gold-foreground: #ffffff;
- --pink: #dc2659;
+ --pink: #c7204f;
--pink-soft: rgba(220, 38, 89, 0.10);
/* Light-theme page gradients (softer alphas over light base). */