Wordpress

WordPress dark mode accessibility: a practical guide

AccessYes Team
AccessYes editorial team

In this article: This guide explains how to add dark mode and high contrast mode to your WordPress site. It’s for site owners and developers who want to support visitors with low vision, light sensitivity, or contrast-related visual impairments. You’ll learn how each display mode works, who benefits from it, and how to implement both options effectively.

Bright white backgrounds, high-saturation colour schemes, and low-contrast text are not just aesthetic choices — for many users, they’re genuine barriers. People with photosensitivity, low vision, or conditions like migraine disorder can find standard website designs physically uncomfortable or impossible to read. Giving users control over how your site displays is one of the most practical steps you can take for WordPress dark mode accessibility.

This guide covers what dark mode and high contrast mode are, who they help, and how to add both to a WordPress site in a way that is robust, accessible, and respectful of user preferences.


Why display modes matter for accessibility

Around 2.2 billion people globally have a near or distance vision impairment, according to the World Health Organisation. Many of them use display customisation — darker backgrounds, stronger contrast, reduced saturation — to make content readable without assistive technology alone.

2.2B people globally live with a near or distance vision impairment Source: World Health Organization, 2023

Display preferences are also relevant to users without a formal diagnosis. Light sensitivity affects people with chronic migraine, multiple sclerosis, traumatic brain injury, and anxiety disorders. A visitor who abandons your site because the bright background triggers a headache is a real user you have lost — not an edge case.

WCAG 1.4.3 (Contrast Minimum) and 1.4.6 (Enhanced Contrast) set the technical bar for text legibility, but those criteria alone do not account for users who need an entirely different colour scheme. Dark mode and high contrast mode extend well beyond the WCAG baseline by giving users direct control over their visual experience.


What is dark mode and who does it help?

Dark mode replaces a light background and dark text with a dark background and light text. It reduces the overall luminance of the screen, which lowers eye strain in low-light environments and reduces glare for users with photosensitivity.

Dark mode is particularly useful for:

  • People with photophobia (light sensitivity), including those with migraine disorder
  • Users with glaucoma or other conditions that cause increased sensitivity to bright light
  • People who use screens for extended periods and experience digital eye strain
  • Users in low-light environments where a bright screen causes discomfort

Dark mode does not automatically satisfy WCAG contrast requirements. A dark background with light text must still meet the same contrast ratios — 4.5:1 for normal text and 3:1 for large text under WCAG 1.4.3.

Tip

When designing a dark colour scheme, avoid pure white (#FFFFFF) text on a pure black (#000000) background. The extreme contrast can cause halation — a blurring effect — for some users with dyslexia or astigmatism. A soft white like #E8E8E8 on a dark grey like #121212 is easier to read.

What is high contrast mode and who does it help?

High contrast mode increases the difference in luminance between foreground and background elements. It often combines a dark background with strongly saturated or pure-white text and removes or simplifies decorative elements that reduce clarity.

High contrast mode is particularly useful for:

  • People with low vision who need strong visual distinction between elements
  • Users with colour vision deficiency (colour blindness) who struggle to distinguish similar hues
  • Older users experiencing age-related contrast sensitivity loss
  • People with cognitive disabilities who benefit from reduced visual complexity

High contrast mode goes further than dark mode. Where dark mode adjusts luminance, high contrast mode also simplifies the visual field — stripping back gradients, shadows, and busy backgrounds to make the core content unmissable.


Adding dark mode and high contrast mode to WordPress

There are two main approaches: using a WordPress accessibility plugin that includes display controls, or building the feature into your theme using CSS and JavaScript.

Option 1: use an accessibility plugin with display controls

The quickest way to add WordPress visual accessibility controls — including dark mode, high contrast mode, and saturation control — is with a dedicated accessibility plugin. AccessYes provides a customisable accessibility widget that adds a panel of display options to your site with no custom code required.

The AccessYes widget includes:

  • Dark mode toggle
  • High contrast mode toggle
  • Saturation control (useful for users who need reduced or increased colour intensity)
  • Text size and spacing adjustments

Users activate the widget, choose their preferred display settings, and the site responds immediately. Preferences are saved for their next visit, so they do not need to re-apply their settings each time.

Note

Accessibility widgets complement, but do not replace, good baseline design. Ensure your default colour scheme already meets WCAG 1.4.3 contrast ratios before adding display mode controls. Use the WebAIM Contrast Checker to test your existing palette.

Option 2: build display modes with CSS custom properties

If you prefer a code-based approach, CSS custom properties (also called CSS variables) make it straightforward to switch colour schemes at the document level. Here is the pattern:

Step 1: define your colour tokens in :root

:root {
  --color-background: #ffffff;
  --color-text: #1a1a1a;
  --color-link: #0055cc;
}

Step 2: define dark mode overrides

[data-theme="dark"] {
  --color-background: #121212;
  --color-text: #e8e8e8;
  --color-link: #7eb8f7;
}

Step 3: define high contrast mode overrides

[data-theme="high-contrast"] {
  --color-background: #000000;
  --color-text: #ffffff;
  --color-link: #ffff00;
}

Step 4: apply your tokens throughout your stylesheet

body {
  background-color: var(--color-background);
  color: var(--color-text);
}

a {
  color: var(--color-link);
}

Step 5: toggle the data-theme attribute with JavaScript

function setTheme(theme) {
  document.documentElement.setAttribute('data-theme', theme);
  localStorage.setItem('preferred-theme', theme);
}

const savedTheme = localStorage.getItem('preferred-theme');
if (savedTheme) {
  document.documentElement.setAttribute('data-theme', savedTheme);
}

Wire this up to clearly labelled toggle buttons in your site header. Make sure each button has a descriptive aria-label, for example aria-label="Switch to dark mode".


Respecting the user’s operating system preference

Many users have already set a dark mode preference at the operating system level. The CSS media feature prefers-color-scheme lets you honour that preference automatically, before the user interacts with any toggle on your site.

@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #121212;
    --color-text: #e8e8e8;
    --color-link: #7eb8f7;
  }
}

Similarly, prefers-contrast: more targets users who have enabled high contrast in their OS settings:

@media (prefers-contrast: more) {
  :root {
    --color-background: #000000;
    --color-text: #ffffff;
    --color-link: #ffff00;
  }
}

Using these media queries as your baseline means users get an appropriate experience even if they never interact with your on-page controls. On-page toggles then give them the flexibility to override or fine-tune.

Tip

If your site uses a plugin-based toggle alongside prefers-color-scheme, make sure the JavaScript reads the OS preference on load and sets the initial toggle state to match. A user who has dark mode set at the OS level should see your toggle already switched to "on" when they arrive.


Saturation control: the often-overlooked third option

Dark mode and high contrast mode get most of the attention, but saturation control is equally valuable for low vision website design. Some users with visual impairments find highly saturated colours distracting or visually painful. Others need increased saturation to distinguish elements that appear washed out to them.

The CSS filter property makes saturation adjustment straightforward:

[data-saturation="low"] body {
  filter: saturate(0.3);
}

[data-saturation="high"] body {
  filter: saturate(2);
}

AccessYes includes a saturation slider in its display panel, so users can dial in the level that works best for them without you needing to write custom CSS.


Conclusion

Supporting users with visual impairments through display customisation is one of the most direct improvements you can make to your WordPress site’s accessibility. The key steps are:

  1. Add dark mode and high contrast mode controls so users can switch to a colour scheme that works for their vision and sensitivity needs.
  2. Use CSS custom properties to keep your colour tokens consistent and easy to override across both schemes.
  3. Respect OS-level preferences with prefers-color-scheme and prefers-contrast as your baseline, and let on-page toggles provide further control.

If you want to add these features without building them from scratch, install AccessYes to get dark mode, high contrast mode, and saturation control ready to go in minutes. You can also read our guide to making your WordPress colour palette WCAG-compliant for the foundational contrast work that makes every display mode more effective.

Related articles