fix(a11y): Admin and User role badges meet text contrast in the light theme with Accessibility Mode on (#35597)

This commit is contained in:
G30 authored and GitHub committed 2026-12-04 07:43:59 +04:00
1 parent f913c3ef24
commit 232a43f7b6
1 file changed
+8 -4
@@ -1,7 +1,7 @@
<script lang="ts">
import { withListFocus } from '$lib/utils/listFocus';
import { WEBUI_API_BASE_URL } from '$lib/constants';
import { adminUserCount, config, user } from '$lib/stores';
import { adminUserCount, config, settings, user } from '$lib/stores';
import { getContext, onDestroy, onMount } from 'svelte';
import dayjs from 'dayjs';
@@ -99,14 +99,18 @@
page = 1;
};
const roleClass = (role) => {
$: roleClass = (role) => {
// Measured from the reference role pill: an indigo label (lighter in dark mode) over an 18%
// wash of indigo. Users get the same treatment in green; pending stays quiet.
if (role === 'admin') {
return 'text-[#5e6ad2] bg-[#5e6ad2]/[0.18] dark:text-[#919eff]';
return ($settings?.highContrastMode ?? false)
? 'text-[#434eb8] bg-[#5e6ad2]/[0.18] dark:text-[#919eff]'
: 'text-[#5e6ad2] bg-[#5e6ad2]/[0.18] dark:text-[#919eff]';
}
if (role === 'user') {
return 'text-emerald-600 bg-emerald-500/[0.18] dark:text-emerald-400';
return ($settings?.highContrastMode ?? false)
? 'text-emerald-800 bg-emerald-500/[0.18] dark:text-emerald-400'
: 'text-emerald-600 bg-emerald-500/[0.18] dark:text-emerald-400';
}
return 'text-base-400 bg-base-500/5 dark:text-base-600';
};