crawl4ai icon indicating copy to clipboard operation
crawl4ai copied to clipboard

fix: apply correct dark mode behavior when light_mode=False

Open 03ShreyanshGoel opened this issue 2 weeks ago • 0 comments


Summary

Fixes #1631

This PR fixes the issue where light_mode=False did not enable dark mode correctly and instead acted as a performance configuration flag. The browser initially launched in light mode and only switched to dark after opening DevTools. The fix introduces proper dark mode support while maintaining backward compatibility with existing integrations.


List of files changed and why

  • BrowserConfig — Renamed light_mode to performance_mode and added a new dark_mode parameter to accurately control UI theme rendering.
  • browser_manager.py — Updated browser launch arguments and implemented color_scheme="dark" handling within create_browser_context.

How Has This Been Tested?

Manual verification by launching the browser with:

BrowserConfig(
    dark_mode=True,
    performance_mode=True,
    enable_stealth=True,
    headless=False,
)

Dark mode now activates immediately without requiring DevTools.


Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have added/updated unit tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes

03ShreyanshGoel avatar Nov 22 '25 16:11 03ShreyanshGoel