I check every site on a phone before it goes live. That check now includes a setting most owners never look at: dark mode.
Some phones and browsers will darken a page on their own when the phone is set to dark mode, even if the site was designed with a light background. The browser changes the colours, not the person who designed the site. What your customer sees is then a version that nobody approved.
What to look for
- Colours that no longer match the design. Text and backgrounds can end up in a combination you never chose.
- A logo sitting in a pale box. A logo made for a light background can look wrong once the page around it goes dark.
- Text that is harder to read. If you have to squint, so does your customer.
- Buttons and forms that look different from the rest of the page.
How to check in a minute
- Turn on dark mode in your phone's display settings.
- Open your website in the phone's browser and look at the home page and the contact page.
- Turn dark mode off and look again. Compare the logo, the buttons and any form.
- Ask someone with a different phone to do the same, because phones do not all behave alike.
The fix is two small lines
One line goes in the head of every page: <meta name="color-scheme" content="only light">. The other goes at the very top of the main stylesheet: :root{color-scheme:only light}. Together they tell the browser to leave the design as it is.
In my testing, plain light did not stop the browser darkening the page. Only only light did. I proved it by taking one screenshot with Chrome's forced dark mode switched on and one with it off, and comparing the two.
One look per site
Locking the colour scheme means a site has one look. I design each site with a single look and keep it, rather than a light version and a dark version. If a site is designed dark, it is locked to dark instead, so it still shows what the client approved.
The trade off is that a visitor who would prefer a dark version does not get one. For a small business site I think a consistent design is worth more than a clever one.
Before you sign off a site
- Ask whether the colour scheme is locked, and which look it is locked to.
- Test it on a real phone with dark mode on, not only in a browser window on a computer.
- Check again after a redesign. A new stylesheet can lose the line.
The short version
If your site was approved on a laptop, look at it once on a phone with dark mode on. If it looks different, the fix is small. I wrote about the other checks I run before a site goes live in the website launch checklist, and a locked colour scheme is part of every website build.
One more thing to check: do Google Fonts on your website break GDPR?