Lovable·Fixstylingbeginner

Dark Mode Not Working in Lovable App

Quick Answer

Lovable may generate a dark mode toggle without applying dark: variants to all Tailwind classes, or without persisting the preference. Start with "Tell Lovable to fix dark mode" before making broader code changes.

You're in the right place if...

  • !Dark mode toggle doesn't change anything
  • !Some elements change but others stay light
  • !Text becomes invisible in dark mode

Why this happens

Lovable may generate a dark mode toggle without applying dark: variants to all Tailwind classes, or without persisting the preference.

Fix

1

Tell Lovable to fix dark mode

This prompt covers all common dark mode issues:

Copy this prompt

Dark mode is not working correctly. Please:
1. Add a proper dark mode toggle that saves preference to localStorage
2. Apply dark: variants to all components
3. Set default to system preference using prefers-color-scheme
4. Make sure text is readable in both modes (check contrast ratios)

Prevent this next time

Include 'with working dark mode that respects system preference' in your founding prompt.

Frequently Asked Questions

Add dark: prefix to classes. dark:bg-gray-900 applies in dark mode. The html element needs a 'dark' class.

Default to system preference. Users expect your app to match their OS setting.

Related fixes

Weekly Newsletter

Get next week's fix before you need it.

Join developers getting weekly vibe coding tips, error fixes, and tool updates.

Subscribe on Substack →