fix(webui): meet WCAG AA for log-level text on light theme
The log-level accent colors (info/success/warn/error) are tuned as fills; as small text on the light canvas they fell below WCAG AA (info 2.6:1, success 2.4:1, warn 2.0:1, error 4.3:1, trace 2.5:1). Add dedicated --log-* text tokens that are darkened in light mode (>=4.5:1) while keeping the bright, already-passing values in dark mode, so the app-wide accent is untouched. trace moves from /60 to /90 to clear AA yet stay the faintest level. Applied to both the logs page and overview RecentAlerts.
This commit is contained in:
3 files changed
+38
-10
No files matched your search
@@ -13,13 +13,17 @@ import { useApi } from '@/lib/api';
|
||||
import { useTheme } from '@/contexts/ThemeContext';
|
||||
import { useLayout } from '@/contexts/LayoutContext';
|
||||
|
||||
// Dedicated log-level text tokens (see index.css): the app accent colors are
|
||||
// too light as small text on the light canvas (WCAG AA fails), so these hit
|
||||
// >=4.5:1 in light mode while keeping the bright values in dark. trace stays the
|
||||
// faintest level (dimmer than debug) but at /90 it now also clears AA.
|
||||
const levelClass: Record<LogLevel, string> = {
|
||||
trace: 'text-muted-foreground/60',
|
||||
trace: 'text-muted-foreground/90',
|
||||
debug: 'text-muted-foreground',
|
||||
info: 'text-primary',
|
||||
success: 'text-success',
|
||||
warn: 'text-warning',
|
||||
error: 'text-destructive',
|
||||
info: 'text-log-info',
|
||||
success: 'text-log-success',
|
||||
warn: 'text-log-warn',
|
||||
error: 'text-log-error',
|
||||
};
|
||||
|
||||
const LEVELS: LogLevel[] = ['trace', 'debug', 'info', 'success', 'warn', 'error'];
|
||||
|
||||
@@ -889,13 +889,16 @@ function AccountWidget({ config }: { config: AccountConfig }) {
|
||||
|
||||
// ─────────────── recent alerts ───────────────
|
||||
|
||||
// Same WCAG-tuned log-level text tokens as the logs page (see index.css / the
|
||||
// levelClass note there): the raw accent colors fail AA as small text on the
|
||||
// light canvas.
|
||||
const ALERT_LEVEL_CLASS: Record<LogLevel, string> = {
|
||||
trace: 'text-muted-foreground/60',
|
||||
trace: 'text-muted-foreground/90',
|
||||
debug: 'text-muted-foreground',
|
||||
info: 'text-primary',
|
||||
success: 'text-success',
|
||||
warn: 'text-warning',
|
||||
error: 'text-destructive',
|
||||
info: 'text-log-info',
|
||||
success: 'text-log-success',
|
||||
warn: 'text-log-warn',
|
||||
error: 'text-log-error',
|
||||
};
|
||||
|
||||
function RecentAlertsCard({ config }: { config: AlertsConfig }) {
|
||||
|
||||
Reference in new issue
Block a user