How to Add Dark Mode to a WordPress Website

On this page
Many visitors browse with dark mode turned on, especially on phones at night. Offering a dark version of your site makes reading more comfortable. Here are three ways to add it.
Option 1: Your theme's built-in dark mode
Some modern themes include a dark palette or a color mode switch in the customizer or site editor styles. Check your theme's settings first; it is the cleanest option.
Option 2: A dark mode plugin
Dark mode plugins add a floating toggle and automatically invert colors. Choose one that:
- Follows the visitor's device setting by default.
- Lets you exclude images, logos and specific elements.
- Remembers the visitor's choice.
Automatic inversion isn't perfect. Check every page type afterwards.
Option 3: CSS with prefers-color-scheme
If your theme uses CSS variables, add a dark palette that follows the device setting:
@media (prefers-color-scheme: dark) {
:root {
--bg: #0f172a;
--text: #e2e8f0;
}
body { background: var(--bg); color: var(--text); }
}
Add it in Appearance > Customize > Additional CSS or a child theme, adjusted to your theme's variables.
Check these after enabling dark mode
- Logo: use a transparent PNG/SVG with a light version.
- Images with white backgrounds: add rounded corners or a small padding so they don't look like holes.
- Text contrast: light grey on dark navy, not pure white on pure black.
- Forms and buttons: input fields must stay visible.
- Ads: keep the "Advertisement" label visible.
Frequently asked questions
Does dark mode affect SEO?
Not directly. It can improve comfort for some readers, which may help engagement.
Should dark mode follow the device setting?
Yes, following the device setting with prefers-color-scheme plus a manual toggle gives visitors the best of both.
My logo disappears in dark mode. How do I fix it?
Use a logo with a transparent background and a light version for dark mode, or add a subtle light background behind the logo.
Will dark mode break my ads?
Ad units keep their own styling. Make sure the area around them still clearly labels them as advertisements.


