Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

fix(ui): give colored badges a per-theme text shade so they meet AA

Sergey Kozyrenkof88427c26426
diff --git a/frontend/e2e/specs/cross/a11y.spec.ts b/frontend/e2e/specs/cross/a11y.spec.ts
index 4aeba9e9..0ec61f62 100644
--- a/frontend/e2e/specs/cross/a11y.spec.ts
+++ b/frontend/e2e/specs/cross/a11y.spec.ts
@@ -14,11 +14,6 @@ const ALLOWLIST: A11yAllowlist = {
// targets are class chains, so the pattern pins the 50%-muted class; any
// other contrast violation on the page still fails.
'/flows/:flowId': [{ rule: 'color-contrast', target: /text-muted-foreground\\?\/50/ }],
- // Colored Badge variants carry a single text shade for both themes, and no
- // shade clears AA on both grounds: measured, blue passes on light (4.66) and
- // fails on dark (3.09) — which is why only the dark scan flags it here. All
- // seven colors share the defect; queued for a per-theme palette fix.
- '/knowledges': [{ rule: 'color-contrast', target: /border-blue-500/ }],
};
// Both themes are scanned: contrast waivers are theme-independent, but dark mode
diff --git a/frontend/e2e/specs/visual/routes.spec.ts-snapshots/knowledges-dark-visual-linux.png b/frontend/e2e/specs/visual/routes.spec.ts-snapshots/knowledges-dark-visual-linux.png
index c6787e6f..eba07526 100644
Binary files a/frontend/e2e/specs/visual/routes.spec.ts-snapshots/knowledges-dark-visual-linux.png and b/frontend/e2e/specs/visual/routes.spec.ts-snapshots/knowledges-dark-visual-linux.png differ
diff --git a/frontend/src/components/ui/badge.tsx b/frontend/src/components/ui/badge.tsx
index 114c4900..7b0fa1a1 100644
--- a/frontend/src/components/ui/badge.tsx
+++ b/frontend/src/components/ui/badge.tsx
@@ -11,18 +11,22 @@ const badgeVariants = cva(
variant: 'default',
},
variants: {
+ // Colored variants carry a per-theme text shade: 700 on the light tint,
+ // 400 on the dark one. A shade number is not a constant lightness across
+ // hues, so green needs 800 — at 700 it measures 4.4991 against its tint
+ // and misses AA. Re-measure before changing a shade or a tint.
variant: {
- blue: 'border-blue-500/20 bg-blue-500/10 text-blue-600 hover:bg-blue-500/20',
+ blue: 'border-blue-500/20 bg-blue-500/10 text-blue-700 hover:bg-blue-500/20 dark:text-blue-400',
default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
destructive: 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
- green: 'border-green-500/20 bg-green-500/10 text-green-600 hover:bg-green-500/20',
- orange: 'border-orange-500/20 bg-orange-500/10 text-orange-600 hover:bg-orange-500/20',
+ green: 'border-green-500/20 bg-green-500/10 text-green-800 hover:bg-green-500/20 dark:text-green-400',
+ orange: 'border-orange-500/20 bg-orange-500/10 text-orange-700 hover:bg-orange-500/20 dark:text-orange-400',
outline: 'text-foreground',
- pink: 'border-pink-500/20 bg-pink-500/10 text-pink-600 hover:bg-pink-500/20',
- purple: 'border-purple-500/20 bg-purple-500/10 text-purple-600 hover:bg-purple-500/20',
- red: 'border-red-500/20 bg-red-500/10 text-red-600 hover:bg-red-500/20',
+ pink: 'border-pink-500/20 bg-pink-500/10 text-pink-700 hover:bg-pink-500/20 dark:text-pink-400',
+ purple: 'border-purple-500/20 bg-purple-500/10 text-purple-700 hover:bg-purple-500/20 dark:text-purple-400',
+ red: 'border-red-500/20 bg-red-500/10 text-red-700 hover:bg-red-500/20 dark:text-red-400',
secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
- yellow: 'border-yellow-500/20 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20',
+ yellow: 'border-yellow-500/20 bg-yellow-500/10 text-yellow-700 hover:bg-yellow-500/20 dark:text-yellow-400',
},
},
},