GlycemicGPTDev
Color Accessibility Guide
Approved semantic color pairings and contrast rules for GlycemicGPT web UI.
Color Accessibility Guide
This guide defines approved color pairings for the current web UI foundation.
Baseline Rules
- The default light and dark themes should pass WCAG AA. See WCAG 2.2 conformance.
- Normal text needs at least
4.5:1contrast. See WCAG 1.4.3 Contrast Minimum. - Large text needs at least
3:1contrast. See WCAG 1.4.3 Contrast Minimum. - Important icons, borders, selected states, and controls need at least
3:1contrast against adjacent colors. See WCAG 1.4.11 Non Text Contrast. - Focus indicators must be visible and should keep at least
3:1contrast against adjacent colors. See WCAG 2.4.7 Focus Visible and WCAG 2.4.13 Focus Appearance. - High contrast mode is an enhancement. It is not a reason to ship known contrast failures in the default theme. See WCAG conforming alternate versions.
- Do not rely on color alone for state, status, or medical meaning. See WCAG 1.4.1 Use of Color.
- Use semantic utilities first. Do not use raw Tailwind palette classes for shared UI.
- If a pairing is not listed here, calculate contrast before using it.
Current Tokens
Light surfaces:
--color-surface-page: #ffffff
--color-surface-primary: #ffffff
--color-surface-secondary: #e6e8e6
--color-surface-tertiary: #ced0ce
Dark surfaces:
--color-surface-page: #3a414b
--color-surface-primary: #3a414b
--color-surface-secondary: #5f6266
--color-surface-tertiary: #949ea8
Foreground:
--color-foreground-primary: #191919 in light, #ffffff in dark
--color-foreground-secondary: #767676 in light, #a7b0ba in dark
--color-foreground-muted: #ced0ce in light, #5f6266 in dark
Accent:
--color-accent: #5eb1ff
--color-accent-hover: #4da8ff in light, #70bdff in dark
--color-accent-foreground: #191919
Signal:
--color-signal-partial-fill: #6f53ca in light, #bbaee6 in dark
--color-signal-partial-text: #6f53ca in light, #e5e0ff in dark
--color-signal-info-fill: #2b7272 in light, #65c5c5 in dark
--color-signal-info-text: #2b7272 in light, #a5f3f3 in dark
--color-signal-check-fill: #2a7643 in light, #67c987 in dark
--color-signal-check-text: #2a7643 in light, #a7f3c0 in dark
--color-signal-warning-fill: #f8c129 in light, #f6a61d in dark
--color-signal-warning-text: #b24600 in light, #ffe08a in dark
--color-signal-error-fill: #cd1d0c in light, #e94b3a in dark
--color-signal-error-text: #cd1d0c in light, #ffd9d5 in darkLight Theme Pairings
Approved for normal text:
bg-surface-pageorbg-surface-primarywithtext-foreground-primary:17.58:1.bg-surface-pageorbg-surface-primarywithtext-foreground-secondary:4.54:1.bg-surface-secondarywithtext-foreground-primary:14.27:1.bg-surface-tertiarywithtext-foreground-primary:11.33:1.bg-accentwithtext-accent-foreground:7.71:1.bg-accent-hoverwithtext-accent-foreground:7.00:1.
Allowed only for large text or non text UI:
bg-surface-secondarywithtext-foreground-secondary:3.69:1.
Not approved for readable text:
bg-surface-pageorbg-surface-primarywithtext-foreground-muted:1.55:1.bg-accentwith white text:2.28:1.
Dark Theme Pairings
Approved for normal text:
bg-surface-pageorbg-surface-primarywithtext-foreground-primary:10.31:1.bg-surface-pageorbg-surface-primarywithtext-foreground-secondary:4.69:1.bg-surface-pageorbg-surface-primarywithtext-accent:4.52:1.bg-surface-secondarywithtext-foreground-primary:6.13:1.bg-accentwithtext-accent-foreground:7.71:1.bg-accent-hoverwithtext-accent-foreground:8.72:1.
Allowed only for large text or non text UI:
bg-surface-tertiarywithtext-foreground-inverse:3.79:1.
Not approved for readable text:
bg-surface-pageorbg-surface-primarywithtext-foreground-muted:1.68:1.bg-surface-secondarywithtext-foreground-secondary:2.79:1.bg-accentwith white text:2.28:1.
Accent Rules
- Use
bg-accent text-accent-foregroundfor selected tabs, primary filled controls, checked controls, and highlight surfaces with text inside. - Do not put white text on
bg-accent. - Use white text on dark surfaces for primary copy.
- Use
text-foreground-secondaryfor secondary paragraphs and labels onbg-surface-pageorbg-surface-primary. - Do not use
text-accentfor paragraph copy. Use it for short emphasis only when the background isbg-surface-pageorbg-surface-primary.
Surface Rules
bg-surface-pageandbg-surface-primarycan host normal text with primary and secondary foreground colors in both themes.bg-surface-secondarycan host normal text only withtext-foreground-primaryin both themes.bg-surface-tertiaryshould not host normal body text in dark mode with the current semantic foreground tokens.text-foreground-mutedis for disabled, decorative, or non essential text only. Do not use it for labels, paragraphs, form hints, or critical metadata.
Signal Color Rules
- Use
*-fillsignal tokens for backgrounds, badges, indicators, chart areas, and alert surfaces. - Use
*-textsignal tokens for signal-colored text and icons on neutral surfaces. - Use only the documented foreground color for text and icons placed directly on matching signal fill backgrounds.
- Do not use a fill token as body text unless its exact background pairing has been checked.
- Light theme signal text tokens pass normal text contrast on page, primary, and secondary surfaces. They pass non text contrast on tertiary.
- Dark theme signal text tokens pass normal text contrast on page, primary, and secondary surfaces. They are not approved on tertiary.
- Do not rely on color alone for medical or safety critical meaning. Pair signal color with text, icon shape, or label. See WCAG 1.4.1 Use of Color.
Signal Contrast Reference
Light theme signal text on neutral surfaces:
signal-partial-text:5.58:1on page or primary,4.53:1on secondary,3.59:1on tertiary.signal-info-text:5.60:1on page or primary,4.54:1on secondary,3.61:1on tertiary.signal-check-text:5.57:1on page or primary,4.52:1on secondary,3.59:1on tertiary.signal-warning-text:5.57:1on page or primary,4.52:1on secondary,3.59:1on tertiary.signal-error-text:5.56:1on page or primary,4.51:1on secondary,3.58:1on tertiary.
Light theme signal fills with documented foreground:
signal-partial-fillwith white text:5.58:1.signal-info-fillwith white text:5.60:1.signal-check-fillwith white text:5.57:1.signal-warning-fillwith ink text:10.59:1.signal-error-fillwith white text:5.56:1.
Dark theme signal text on neutral surfaces:
signal-partial-text:8.07:1on page or primary,4.80:1on secondary,2.13:1on tertiary.signal-info-text:8.20:1on page or primary,4.88:1on secondary,2.17:1on tertiary.signal-check-text:7.96:1on page or primary,4.74:1on secondary,2.10:1on tertiary.signal-warning-text:7.99:1on page or primary,4.75:1on secondary,2.11:1on tertiary.signal-error-text:7.92:1on page or primary,4.71:1on secondary,2.09:1on tertiary.
Dark theme signal fills with documented foreground:
signal-partial-fillwith ink text:8.63:1.signal-info-fillwith ink text:8.66:1.signal-check-fillwith ink text:8.61:1.signal-warning-fillwith ink text:8.70:1.signal-error-fillwith ink text:4.63:1.
Agent Workflow
- Start with the semantic pairing listed above.
- If the pair is not listed, calculate the contrast ratio before coding.
- If the pair fails, change the semantic mapping or add a narrowly justified semantic token.
- Do not solve a shared UI contrast problem with a local raw color class.
- Update this guide when shared token values or approved pairings change.