Skip to content
Every tutorial here is 100% free — and always will be
LSLovableStudent

How do I add dark mode?

Last checked 31 Aug 2026

Short answer

Ask Lovable to add a theme toggle using Tailwind's dark mode classes and shadcn/ui's theming support, then check every page and component — including third-party embeds — for readable contrast in both themes.

How Lovable typically implements it

Tailwind supports dark mode via a dark: variant, and shadcn/ui components are built with CSS variables that make theme switching straightforward. Ask for the whole system, not just a toggle:

Add a light/dark mode toggle in the header. Use Tailwind's dark mode classes and the existing shadcn theme variables so all components (buttons, cards, inputs) adapt automatically. Remember the user's choice across visits.

What to check once it's built

  • Contrast: text that was fine on a white background may fail contrast on dark backgrounds, and vice versa — check headings, body text and muted/secondary text in both modes.
  • Images and logos: a logo designed for light backgrounds can disappear or look wrong on dark — you may need a separate dark-mode logo asset.
  • Custom-coloured elements: anything with a hardcoded colour (not a theme variable) won't switch automatically — ask Lovable to find and fix these.
  • Third-party embeds: payment forms, maps, or chat widgets often have their own fixed styling and won't follow your dark mode — this is a real limitation, not a bug to chase.
  • Persistence: confirm the chosen theme persists across page reloads and, ideally, respects the visitor's system preference by default on first visit.

What usually goes wrong

  • Toggling dark mode reveals text or icons that are invisible (dark text on dark background) because they were hardcoded rather than using theme variables — this is the most common issue, and worth a dedicated pass.
  • Building dark mode only for the pages you tested, missing others — ask Lovable to sweep every page.
  • Adding dark mode without a visible, easy-to-find toggle — placement in the header or footer, not buried in settings, unless the site is an authenticated app with a settings page.

Sources

Was this answer helpful?

Related questions

Website made, maintained and hosted by PromptSites.com

PromptSites logo