{
  "id": 23029511,
  "title": "Building a Readable Dark Mode for a Law Firm Website With CSS",
  "url": "https://urgent.news/2026/12/01/building-a-readable-dark-mode-for-a-law-firm-website-with-css",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-01T23:27:41.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/sbdmarketing/building-a-readable-dark-mode-for-a-law-firm-website-with-css-3lc6"
  },
  "original_language": null,
  "account": "Creating a readable dark mode for a law firm website is a straightforward project when approached methodically with CSS. Begin by defining colors as custom properties and using color tokens throughout the site. This allows easy swapping of values in a prefers-color-scheme media query. Components should never reference raw hex values, only the tokens. The root CSS rule declares light and dark color schemes, assigning hex values to tokens for background, text, muted colors, accent colors, and call-to-action (CTA) styles. The @media query for dark prefers-color-scheme overrides these values, providing a darker background and lighter text. The body element applies the chosen background and text colors from the root's tokens.\n\nEnsuring high contrast in both modes is crucial. The WCAG 2 standard sets a minimum contrast ratio of 4.5 to 1 for normal body text at level AA. Verify contrast ratios for each token pair across light and dark modes using a contrast checker. Avoid pure black backgrounds with pure white text, and instead opt for a dark gray background with off-white text for long pages. Maintain brand colors' readability by selecting appropriate lightness levels and possibly creating lighter versions of accent colors for dark mode.\n\nFocused attention should be given to the call button, as it's the most critical element for user interaction in dark mode. Test its visibility on a real phone in a dark room. Use light blue backgrounds with dark text to maintain contrast and brand consistency. If the site includes a sticky call bar, add a subtle top border in dark mode to distinguish it from the page content. Logos saved as transparent PNGs with dark lettering may disappear on dark backgrounds. Use SVG logos that use the currentColor property or switch to a light version of the logo using a picture element and a media query. Attorney headshots and office photos generally appear fine in both modes, so no special adjustments are needed. Avoid applying filters or reduced brightness to photos of people, as it can negatively affect their appearance. Decorative background images might require a darker overlay to ensure text readability.\n\nThird-party widgets like chat boxes and intake forms may ignore the color tokens. Test each widget individually in dark mode, checking if the vendor offers a dark theme option or if it can be styled through their own settings. If styling isn't possible, encase the widget in a container with a light background and ample padding to make it visually distinct. Review testimonial widgets and any other third-party content to ensure they're readable in dark mode.\n\nThe decision to incorporate a manual toggle for dark mode depends on the firm's preference. Adding a toggle introduces extra code and a stored preference, typically managed through a cookie or local storage. Assign a data-theme attribute to the root element to store the user's choice and ensure it overrides the media query settings. Always test that the toggle doesn't cause a flash of the wrong theme during page load. For additional insights on layout, typography, and visual design decisions, refer to the law firm website design library. SBD Marketing specializes in website design for criminal defense firms, focusing on SEO tailored to the charges they defend, online visibility, and SEO audits. Queries about dark mode and its impact on SEO or branding are addressed accordingly.",
  "summary": "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…",
  "summary_source": "publisher",
  "key_points": [
    "Define colors as custom properties using color tokens",
    "Apply root CSS rule for light and dark color schemes",
    "Ensure high contrast in both light and dark modes"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}