Knowledgebase

Implementing Dark Mode and Themes Print

  • frontenddevelopment, frontend, themes, troubleshooting, guide, howto, solution, zillionkinghost
  • 0

Alternative appearances.

WHAT TO BASE IT ON

Custom properties, redefined per theme.

WHY

They change at runtime, which build-time variables cannot.

WHAT TO RESPECT

The system preference, as the default.

WHAT TO PROVIDE

A control to override it, with the choice remembered.

WHAT TO OFFER

Three options: light, dark, and follow the system.

WHY

Some people want a fixed choice regardless of the system.

WHAT TO AVOID

A flash of the wrong theme on load.

WHAT CAUSES IT

Applying the theme after the page has rendered.

WHAT TO DO ABOUT IT

Apply it before first paint, with a small inline script.

WHAT TO CHECK IN A DARK THEME

Contrast, which is not automatically adequate Images and logos, which may need alternatives Shadows, which do not work the same way Pure black and pure white, which are harsh

WHAT TO PREFER

Near-black and near-white.

WHAT TO TEST

Both themes, fully, including every state.

WHAT NOT TO ASSUME

That inverting colours produces a good dark theme.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot