Skip to content

Instantly share code, notes, and snippets.

@Mgregchi
Created October 15, 2025 20:10
Show Gist options
  • Select an option

  • Save Mgregchi/7290413c1bae693a4e739e043861397b to your computer and use it in GitHub Desktop.

Select an option

Save Mgregchi/7290413c1bae693a4e739e043861397b to your computer and use it in GitHub Desktop.
Creating an accessible color guide for UI design ensures that your interface is usable by people with visual impairments, including color blindness, low vision, or other visual challenges. Below is a concise guide to help you choose and implement accessible colors for UI design, based on established accessibility standards like WCAG (Web Content…

Below is a guide for creating an accessible color palette for UI design, focusing on color levels suitable for visually impaired users, including those with color blindness or low vision. I'll also suggest how to illustrate these concepts with images to effectively communicate accessibility principles. Since you mentioned images, I'll assume you want guidance on creating or describing visuals to illustrate the color guide, but I'll ask for confirmation if you want me to generate images.

1. Accessible Color Levels for Visually Impaired Users

To ensure accessibility, colors must meet contrast requirements and be distinguishable for users with visual impairments, including low vision and color blindness (e.g., deuteranopia, protanopia, tritanopia, or monochromacy). Below are color levels and guidelines for what visually impaired users can and cannot see.

Color Levels for Accessibility

  • High-Contrast Colors (Visible to Most):

    • Black on White: #000000 (text) on #FFFFFF (background) – Contrast ratio: 21:1.

      • Visible to nearly all users, including those with low vision or color blindness.
    • Dark Gray on Light Gray: #333333 on #E0E0E0 – Contrast ratio: ~10:1 (check exact ratio).

      • Safe for most users, including those with low vision.
    • Blue on White: #0052CC on #FFFFFF – Contrast ratio: ~8:1.

      • Distinguishable for most colorblind users (red-green safe).
  • Moderate-Contrast Colors (Potentially Problematic):

    • Light Gray on White: #CCCCCC on #FFFFFF – Contrast ratio: ~1.7:1.

      • Not visible to users with low vision; fails WCAG standards.
    • Yellow on White: #FFFF00 on #FFFFFF – Contrast ratio: ~1.1:1.

      • Not visible to users with low vision or tritanopia (blue-yellow color blindness).
  • Low-Contrast or Colorblind-Unfriendly Colors (Not Visible):

    • Red on Green: #FF0000 on #00FF00 – Contrast ratio: ~2.1:1.

      • Not distinguishable for red-green colorblind users (deuteranopia/protanopia).
    • Green on Gray: #28A745 on #808080 – Contrast ratio: ~2.5:1.

      • Not visible to users with low vision or color blindness; fails WCAG.
    • Pure Red on Black: #FF0000 on #000000 – Contrast ratio: ~5.3:1.

      • May be visible but hard to distinguish for protanopia (red-weak) users.

Color Blindness Considerations

  • Red-Green Color Blindness (Deuteranopia/Protanopia):

    • Safe: Blue (#0052CC), orange (#FFA500), or white/black combinations.

    • Not Safe: Red (#FF0000) on green (#00FF00) or similar hues.

  • Blue-Yellow Color Blindness (Tritanopia):

    • Safe: Red (#DC3545), green (#28A745), or high-contrast grayscale.

    • Not Safe: Blue (#0000FF) on yellow (#FFFF00).

  • Monochromacy (Total Color Blindness):

    • Safe: High-contrast grayscale (e.g., #000000 on #FFFFFF).

    • Not Safe: Any low-contrast or color-reliant combinations.

WCAG Compliance

  • Text: Minimum 4.5:1 for normal text, 3:1 for large text (18pt or 14pt bold).

  • Non-Text (UI elements, icons): Minimum 3:1.

  • Test Tools: Use WebAIM Contrast Checker or Stark to verify ratios.

2. Illustrating Accessibility with Images

To effectively communicate which colors are accessible and which are not, you can create or describe images that demonstrate these principles. Below are suggestions for images to illustrate the color guide, tailored for UI design and visual impairment considerations.

Image 1: Contrast Ratio Comparison

  • Description:

    • A side-by-side comparison of text on backgrounds with different contrast ratios.

    • Left Side (Accessible): Black text (#000000) on white (#FFFFFF), labeled "Contrast: 21:1 (WCAG AA Compliant)".

    • Right Side (Inaccessible): Light gray text (#CCCCCC) on white (#FFFFFF), labeled "Contrast: 1.7:1 (Fails WCAG)".

    • Include a caption: "High contrast ensures readability for low-vision users."

  • Purpose: Shows how contrast impacts readability.

  • Optional Addition: Include a simulated low-vision filter (blurred or desaturated) to show how the inaccessible side becomes unreadable.

Image 2: Color Blindness Simulation

  • Description:

    • A UI mockup (e.g., a form with buttons) shown in three views:

      • Normal Vision: Full-color UI with red "Error" button (#DC3545) and green "Success" button (#28A745).

      • Deuteranopia Simulation: Same UI but processed through a color blindness simulator (e.g., Coblis), showing red and green as indistinguishable.

      • Accessible Fix: Same UI with added icons (e.g., "X" for error, checkmark for success) and high-contrast text labels.

    • Caption: "Use icons and labels to support colorblind users."

  • Purpose: Demonstrates why relying solely on color fails for colorblind users and how to fix it.

Image 3: Accessible Color Palette

  • Description:

    • A chart showing a recommended UI color palette:

      • Primary Colors: Blue (#0052CC), orange (#FFA500).

      • Semantic Colors: Green (#28A745, success), red (#DC3545, error), yellow (#FFC107, warning).

      • Neutrals: White (#FFFFFF), black (#000000), gray (#333333, #E0E0E0).

    • Each color swatch includes:

      • Hex code.

      • Contrast ratio against white/black (e.g., #0052CC on #FFFFFF: 8:1).

      • Label: "Safe for color blindness" or "Use with caution."

    • Caption: "Accessible color palette for UI design."

  • Purpose: Provides a practical reference for designers.

Image 4: UI Component Examples

  • Description:

    • A mockup of UI elements (buttons, links, form fields) in accessible and inaccessible states.

    • Accessible:

      • Button: Blue (#0052CC) with white text (#FFFFFF), contrast 8:1.

      • Link: Underlined blue (#0052CC) on white (#FFFFFF), with hover state (brighter blue #007BFF).

      • Form Field: Black border (#000000) with clear focus indicator (e.g., 2px yellow outline #FFC107).

    • Inaccessible:

      • Button: Light gray (#CCCCCC) on white (#FFFFFF), contrast 1.7:1.

      • Link: Non-underlined red (#FF0000) on green (#00FF00), indistinguishable for colorblind users.

    • Caption: "Accessible UI elements ensure usability for all."

  • Purpose: Shows real-world application of color choices.

Image 5: Dark Mode vs. Light Mode

  • Description:

    • A split-screen UI showing the same interface in light and dark modes.

      • Light Mode: White background (#FFFFFF) with black text (#000000).

      • Dark Mode: Dark gray background (#121212) with light gray text (#E0E0E0).

    • Include contrast ratios for key elements (e.g., text, buttons).

    • Caption: "Test accessibility in both light and dark themes."

  • Purpose: Highlights the need to check contrast in different themes.

3. Creating or Sourcing Images

  • Tools to Create Images:

    • Figma/Sketch: Design UI mockups and export as PNG/JPG.

    • Adobe XD: Create interactive prototypes to show hover/focus states.

    • Canva: Build simple color charts or infographics.

  • Simulating Visual Impairments:

    • Coblis (Color Blindness Simulator): Upload UI screenshots to simulate color blindness.

    • Stark Plugin: Use in Figma/Sketch to test contrast and simulate impairments.

    • Color Oracle: Desktop app for real-time color blindness simulation.

  • Stock Images:

    • Search for "accessible UI design" or "color contrast examples" on platforms like Unsplash or Shutterstock for inspiration.

    • Example search on X: "accessible UI color palette" (I can search X for specific posts if needed).

  • Confirmation for Image Generation:

    • If you want me to generate these images (e.g., color charts or UI mockups), please confirm, and I’ll provide a detailed description or coordinate with you on specifics.

4. Additional Tips for Accessibility

  • Supplement Colors: Use icons, patterns (e.g., stripes for warnings), or text labels to convey meaning without relying on color.

  • Test with Users: Conduct usability testing with visually impaired users to validate your color choices.

  • Document Palette: Create a style guide with hex codes, contrast ratios, and usage notes (e.g., “Use #0052CC for primary buttons with white text”).

  • Dynamic Options: Offer high-contrast or grayscale modes in your UI for users with specific needs.

5. Example Accessible Palette

  • Background: #FFFFFF (light mode), #121212 (dark mode).

  • Text: #000000 (light mode), #E0E0E0 (dark mode).

  • Primary: #0052CC (blue, safe for most colorblind users).

  • Success: #28A745 (green, use with icons).

  • Error: #DC3545 (red, use with white text).

  • Warning: #FFC107 (yellow, use with black text).

Creating an accessible color guide for UI design ensures that your interface is usable by people with visual impairments, including color blindness, low vision, or other visual challenges. Below is a concise guide to help you choose and implement accessible colors for UI design, based on established accessibility standards like WCAG (Web Content Accessibility Guidelines).

1. Understand Accessibility Standards

  • WCAG 2.1/2.2 Guidelines:
    • Contrast Ratio:
      • Text and non-text elements: Minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text (18pt or 14pt bold) or graphical elements.
      • Non-text elements: At least 3:1 for UI components (e.g., buttons, icons) and meaningful graphics.
    • Color Blindness: Avoid relying solely on color to convey information (e.g., red for errors, green for success). Use patterns, icons, or text labels alongside colors.
  • Level AA Compliance: Most UI designs aim for WCAG Level AA, which ensures usability for a broad audience.

2. Choosing Accessible Colors

  • High Contrast Colors:
    • Use tools like WebAIM Contrast Checker or Stark to test color combinations.
    • Examples of safe combinations:
      • Black text (#000000) on white background (#FFFFFF): Contrast ratio of 21:1.
      • Dark gray (#333333) on light gray (#E0E0E0): Check for sufficient contrast.
    • Avoid low-contrast pairings like light gray on white or yellow on white.
  • Color Blindness Considerations:
    • Common types: Red-green (deuteranopia, protanopia), blue-yellow (tritanopia), and total color blindness (monochromacy).
    • Use colors distinguishable by all types, e.g.:
      • Blue (#0000FF) and orange (#FFA500) are generally safe for red-green color blindness.
      • Avoid red-green combinations (e.g., red text on green background).
    • Test with simulators like Coblis or Color Oracle to see how your UI looks to colorblind users.
  • Avoid Overly Bright Colors:
    • Neon or highly saturated colors (e.g., #FF0000 pure red) can cause eye strain. Opt for slightly muted tones with sufficient contrast.

3. Color Palette Recommendations

  • Primary Colors: Choose a primary color for branding (e.g., blue #0052CC) and ensure it contrasts well with backgrounds.
  • Neutral Colors: Use shades of gray for backgrounds, borders, or secondary elements (e.g., #F5F5F5 for light backgrounds, #333333 for dark text).
  • Accent Colors: Use sparingly for highlights (e.g., buttons, links). Ensure they meet contrast requirements.
  • Semantic Colors:
    • Success: Green (e.g., #28A745, pair with white text).
    • Warning: Yellow/orange (e.g., #FFC107, ensure contrast with black text).
    • Error: Red (e.g., #DC3545, use with white text for contrast).
    • Info: Blue (e.g., #17A2B8, check contrast).

4. Best Practices for UI Implementation

  • Don’t Rely on Color Alone:
    • Use icons, text labels, or patterns to convey meaning (e.g., an "X" for errors, a checkmark for success).
    • Example: Instead of just coloring a button red for "delete," add a trash can icon.
  • Background and Foreground:
    • Ensure sufficient contrast between text/buttons and their backgrounds.
    • Example: White text on a dark blue button (#0052CC) works well (contrast ratio ~5:1).
  • Hover/Focus States:
    • Ensure interactive elements (buttons, links) have clear visual cues for hover and focus states (e.g., underline links, add a border for focus).
    • Maintain contrast in all states (e.g., don’t dim a button to a low-contrast color on hover).
  • Dark Mode:
    • For dark themes, use light text (e.g., #E0E0E0) on dark backgrounds (e.g., #121212).
    • Test contrast ratios in both light and dark modes.
  • Dynamic Adjustments:
    • Provide high-contrast mode options for users with low vision.
    • Allow users to customize colors or themes in your UI settings.

5. Tools for Testing Accessibility

  • Contrast Checkers:
    • WebAIM Contrast Checker: Input hex codes to verify contrast ratios.
    • Contrast Ratio: Simple tool for testing text/background combinations.
  • Color Blindness Simulators:
    • Coblis: Upload UI screenshots to simulate color blindness.
    • Stark: Plugin for Figma/Sketch to test designs.
  • Screen Reader Testing:
    • Ensure color-coded information is accessible via screen readers (e.g., NVDA, VoiceOver).
  • Browser Tools:
    • Use Chrome DevTools or Firefox’s Accessibility Inspector to check contrast and color usage.

6. Example Accessible Color Palette

  • Background: #FFFFFF (white) or #121212 (dark mode).
  • Text: #000000 (black) or #E0E0E0 (light gray for dark mode).
  • Primary Button: #0052CC (blue, with white text #FFFFFF).
  • Success: #28A745 (green, with white text).
  • Warning: #FFC107 (yellow, with black text #000000).
  • Error: #DC3545 (red, with white text).

7. Additional Tips

  • Test with Real Users: Conduct usability testing with people who have visual impairments.
  • Document Your Palette: Create a style guide with hex codes, contrast ratios, and usage rules.
  • Stay Consistent: Use a limited palette to maintain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment