crawl4ai
crawl4ai copied to clipboard
fix: apply correct dark mode behavior when light_mode=False
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— Renamedlight_modetoperformance_modeand added a newdark_modeparameter to accurately control UI theme rendering.browser_manager.py— Updated browser launch arguments and implementedcolor_scheme="dark"handling withincreate_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