Skip to content

πŸ™Œ OpenHands: AI-Driven Development

refactor(theme): apply semantic colors to connection banners (#18493)

Engel Nyst0c7c2258a8ac
diff --git a/__tests__/themes/color-themes.test.tsx b/__tests__/themes/color-themes.test.tsx
index f8cb194602..522b7152c8 100644
--- a/__tests__/themes/color-themes.test.tsx
+++ b/__tests__/themes/color-themes.test.tsx
@@ -60,6 +60,31 @@ describe("color themes", () => {
).toBeGreaterThanOrEqual(4.5);
}
+ const statusSurfaces = ["--oh-color-base", "--oh-color-base-secondary"];
+ const statusTextRoles = [
+ ["--oh-feedback-success", "--oh-status-success"],
+ ["--oh-feedback-error", "--oh-status-error"],
+ ] as const;
+ for (const surfaceToken of statusSurfaces) {
+ const base = channels(resolve(surfaceToken));
+ for (const [textRole, statusRole] of statusTextRoles) {
+ const tint = channels(resolve(statusRole)).map(
+ (channel, index) => channel * 0.05 + base[index] * 0.95,
+ );
+ expect(
+ contrast(luminance(resolve(textRole)), luminance(tint)),
+ `${textRole} against a 5% ${statusRole} tint over ${surfaceToken}`,
+ ).toBeGreaterThanOrEqual(4.5);
+ }
+ }
+ expect(
+ contrast(
+ luminance(resolve("--oh-contrast")),
+ luminance(resolve("--oh-surface-raised")),
+ ),
+ "--oh-contrast against the configured credential banner surface",
+ ).toBeGreaterThanOrEqual(4.5);
+
// Focus contrast includes each neutral control surface.
for (const surfaceRole of [
"--oh-color-base",
diff --git a/src/components/features/onboarding/steps/check-backend-step.tsx b/src/components/features/onboarding/steps/check-backend-step.tsx
index 96487a2409..26da65e3d1 100644
--- a/src/components/features/onboarding/steps/check-backend-step.tsx
+++ b/src/components/features/onboarding/steps/check-backend-step.tsx
@@ -55,15 +55,15 @@ function ConnectionBanner({
role="status"
data-testid="onboarding-backend-connected"
className={cn(
- "flex items-start gap-3 rounded-xl border border-green-500/40 bg-green-500/10 px-4 py-3",
+ "flex items-start gap-3 rounded-xl border border-status-success/40 bg-status-success/5 px-4 py-3",
)}
>
- <CheckCircle2 className="mt-0.5 size-5 shrink-0 text-green-400" />
+ <CheckCircle2 className="mt-0.5 size-5 shrink-0 text-status-success" />
<div className="flex flex-col gap-1">
- <span className="text-sm font-medium text-green-200">
+ <span className="text-sm font-medium text-feedback-success">
{t(I18nKey.ONBOARDING$BACKEND_CONNECTED_TITLE)}
</span>
- <span className="text-xs text-green-200/80">
+ <span className="text-xs text-feedback-success">
{t(I18nKey.ONBOARDING$BACKEND_CONNECTED_BODY)}
</span>
</div>
@@ -80,14 +80,14 @@ function ConnectionBanner({
<div
role="alert"
data-testid="onboarding-backend-disconnected"
- className="flex items-start gap-3 rounded-xl border border-red-500/40 bg-red-500/10 px-4 py-3"
+ className="flex items-start gap-3 rounded-xl border border-status-error/40 bg-status-error/5 px-4 py-3"
>
- <AlertCircle className="mt-0.5 size-5 shrink-0 text-red-400" />
+ <AlertCircle className="mt-0.5 size-5 shrink-0 text-status-error" />
<div className="flex flex-col gap-1">
- <span className="text-sm font-medium text-red-200">
+ <span className="text-sm font-medium text-feedback-error">
{statusLabel}
</span>
- <span className="text-xs text-red-200/80">
+ <span className="text-xs text-feedback-error">
{t(I18nKey.ONBOARDING$BACKEND_DISCONNECTED_BODY)}
</span>
</div>
diff --git a/src/components/features/settings/acp-auth-status-banner.tsx b/src/components/features/settings/acp-auth-status-banner.tsx
index cecd98190e..89bba0f003 100644
--- a/src/components/features/settings/acp-auth-status-banner.tsx
+++ b/src/components/features/settings/acp-auth-status-banner.tsx
@@ -60,9 +60,12 @@ export function AcpAuthStatusBanner({
data-testid={`${testIdPrefix}-detected`}
// Matches the onboarding "backend connected" success banner
// (check-backend-step.tsx) for a consistent look.
- className="flex items-start gap-2 rounded-xl border border-green-500/40 bg-green-500/10 px-4 py-3 text-sm text-green-200"
+ className="flex items-start gap-2 rounded-xl border border-status-success/40 bg-status-success/5 px-4 py-3 text-sm text-feedback-success"
>
- <Check className="mt-0.5 size-4 shrink-0 text-green-400" aria-hidden />
+ <Check
+ className="mt-0.5 size-4 shrink-0 text-status-success"
+ aria-hidden
+ />
<span>
{t(I18nKey.ONBOARDING$ACP_AUTH_DETECTED, { provider: providerName })}
</span>
@@ -88,12 +91,12 @@ export function AcpAuthStatusBanner({
return (
<div
data-testid={`${testIdPrefix}-configured`}
- // Neutral/info tone β€” deliberately NOT the green "signed in" look, since
- // a stored credential is not a verified host login.
- className="flex items-start gap-2 rounded-xl border border-blue-500/40 bg-blue-500/10 px-4 py-3 text-sm text-blue-200"
+ // Neutral/info tone β€” deliberately not the green "signed in" look,
+ // since a stored credential is not a verified host login.
+ className="flex items-start gap-2 rounded-xl border border-border-subtle bg-surface-raised px-4 py-3 text-sm text-contrast"
>
<KeyRound
- className="mt-0.5 size-4 shrink-0 text-blue-400"
+ className="mt-0.5 size-4 shrink-0 text-text-secondary"
aria-hidden
/>
<span>