Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Building a Readable Dark Mode for a Law Firm Website With CSS

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…

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.

Ensuring 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.

Focused 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.

Third-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.

The 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.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Exact 3D Pipe & Tube Coping Math in TypeScript: Zero-Grind Inner-Wall Fit-Up, Double-End Clocking & Strict AutoCAD R12 Rotary DXF

Anyone who has built a 1.75" × 0.120" DOM roll cage or Schedule 40 pipe handrail knows the frustration of printing an online fishmouth coping template, cutting faithfully along the line, and still…

  • TypeScript-based geometry engine addresses 3D inner-wall coping issues
  • Calculates 3D inner and outer cylinder intersections with eccentricities
  • Eliminates gaps by evaluating max of outer/inner wall intersections

SMS Alert Service vs Email — Prefer Email for Startup App Viewing Confirmations

For a property-management startup app seeking an SMS alert service alternative, the easiest verification-link integration depends on which contact channel the signup flow already requires: choose…

  • Use email for signup verification if phone number collected.
  • SMS adds complexity before needed for view confirmations.
  • Maintain separate identifiers for signup challenge, notification, submission.

Your Agent's Memory Is Not the Current State of Your Repo

A green “tests passed” badge can be wrong without anybody lying. Imagine resuming a coding-agent session. Its checkpoint says the form validation tests passed.

  • Coding-agent retains old test results as current evidence
  • Separating agreement and enforcement processes is crucial
  • Mark current validation status as unknown after reconciliation

Why does my MIDI encoder jump? Check which way it reads 65

If turning an endless MIDI encoder nudges a knob down instead of up, don't start by adjusting sensitivity. Turn it two slow clicks right, then one left, and log the last data byte of each Control…

  • Encoder may jump unexpectedly due to incorrect reading direction.
  • Log last data byte of Control Change messages to diagnose.
  • Ensure receiver's mapping mode matches controller's encoding.

More from Tuesday, 1 December 2026 →