A lot of people looking for a criminal defense lawyer are reading at night. Someone gets a call from the county jail at 2 a.m. and starts searching on a phone that has been set to dark mode for months. When they tap a result and land on a bright white page, the contrast is harsh enough that some readers back out before reading the first line.
Supporting dark mode on a law firm site is a small project. Done badly, it produces gray text on gray backgrounds, invisible logos and phone buttons that disappear. This article covers how to build it with plain CSS, how to keep it readable, and which parts of a law firm site need special attention.
Start with color tokens
The cleanest approach is to define every color once as a custom property and swap the values in a prefers-color-scheme media query. Components never refer to raw hex values, only to the tokens.
:root { color-scheme: light dark; --bg: #ffffff; --text: #16181d; --muted: #555b66; --accent: #1f5fd6; --cta-bg: #1f5fd6; --cta-text: #ffffff; } @media (prefers-color-scheme: dark) { :root { --bg: #121418; --text: #e8eaee; --muted: #a6adb8; --accent: #7fb0ff; --cta-bg: #7fb0ff; --cta-text: #0b1020; } } body { background: var(--bg); color: var(--text); } The color-scheme declaration tells the browser the page supports both modes, so form controls and scrollbars follow along without extra styling.
Check contrast in both modes
WCAG 2 sets a minimum contrast ratio of 4.5 to 1 for normal body text at level AA. Run every token pair through a contrast checker in both modes. Muted text is where most dark themes fail, since a gray that looks subtle on white often becomes unreadable on near-black.
Avoid pure black backgrounds with pure white text. The contrast is technically high, but many readers find it causes glare and halo effects on bright phone screens. A very dark gray background with an off-white text color is easier to read for long pages such as charge explainers.
Brand colors need the same check. A navy accent that works on white usually fails on a dark background and needs a lighter version for dark mode. This piece on brand colors that stay readable on a defense firm website covers how to choose those pairs without losing the firm's identity.
Give the call button the most attention
On a defense firm site, the phone button is the element that matters most. In dark mode, test it on a real phone in a dark room. It should be the most visible thing on the screen without glowing so brightly that it looks like an error.
Keep the button text color tied to its own token rather than reusing the body text color. In the example above, the dark mode button uses a light blue background with dark text, which keeps contrast high and still reads as the firm's accent color.
If the site has a sticky call bar at the bottom of mobile screens, give it a subtle top border in dark mode so it separates from the page content behind it.
Handle logos and photos
A logo saved as a transparent PNG with dark lettering will vanish on a dark background. Use an SVG logo whose fill uses currentColor or a token, or swap to a light version of the logo with a picture element and a media query on the source.
Attorney headshots and office photos usually look fine in both modes. Avoid applying filters or reduced brightness to photos of people, since it can make a lawyer look tired or washed out. Decorative background images may need a darker overlay so text on top stays readable.
Watch embeds and third-party widgets
Chat widgets, intake forms embedded from a vendor and map embeds often ignore your tokens. Check each one in dark mode. Some vendors offer a dark theme setting, and some can be styled through their own options. If a widget cannot be styled, place it inside a container with a light background and clear padding so it looks intentional rather than broken.
Review pages and testimonial widgets also need checking, along with anything else that pulls content from another service.
Decide whether to add a manual toggle
Following the operating system setting is enough for most firm sites. A manual toggle adds code and a stored preference. If the firm wants one, store the choice in a cookie or local storage, apply a data-theme attribute on the root element, and make sure the stored choice wins over the media query. Test that the page does not flash the wrong theme while loading.
For more on layout, typography and visual decisions, see the law firm website design library.
SBD Marketing works only with criminal defense firms, one firm per city. It helps those firms with website design, SEO for the charges they defend, visibility in AI search tools, and SEO audits.
Questions about dark mode on law firm sites
Does dark mode affect SEO?
Not directly. It changes how the page looks, not its content or structure. The benefit is readers staying on the page instead of leaving.
Should the firm's brand colors change in dark mode?
The hue can stay, but lightness usually needs adjusting so text and buttons stay readable on a dark background.
How do we test dark mode without a phone?
Browser developer tools can emulate the dark color scheme. Always confirm on at least one real phone before launch.