Skip to content

Comments

add --color-scheme flag for persistent dark/light mode#528

Merged
ctate merged 1 commit intomainfrom
ctate/fix-519
Feb 23, 2026
Merged

add --color-scheme flag for persistent dark/light mode#528
ctate merged 1 commit intomainfrom
ctate/fix-519

Conversation

@ctate
Copy link
Collaborator

@ctate ctate commented Feb 23, 2026

Fixes #519. Playwright defaults colorScheme to light on all new contexts, overriding the browser/OS dark mode setting. This is especially disruptive in CDP mode, where every reconnection resets the scheme. The set media dark command also didn't persist its choice to new tabs or pages.

  • Add --color-scheme <dark|light|no-preference> flag, config key (colorScheme), and env var (AGENT_BROWSER_COLOR_SCHEME)
  • Store the preference in BrowserManager and automatically apply it to all new contexts (via Playwright's context option) and all new pages (via page.emulateMedia in setupPageTracking)
  • set media dark/light now also persists its choice for subsequent pages and tabs

Fixes #519. Playwright defaults `colorScheme` to `light` on all new contexts, overriding the browser/OS dark mode setting. This is especially disruptive in CDP mode, where every reconnection resets the scheme. The `set media dark` command also didn't persist its choice to new tabs or pages.

- Add `--color-scheme <dark|light|no-preference>` flag, config key (`colorScheme`), and env var (`AGENT_BROWSER_COLOR_SCHEME`)
- Store the preference in `BrowserManager` and automatically apply it to all new contexts (via Playwright's context option) and all new pages (via `page.emulateMedia` in `setupPageTracking`)
- `set media dark/light` now also persists its choice for subsequent pages and tabs
@vercel
Copy link
Contributor

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser Ready Ready Preview, Comment Feb 23, 2026 7:43am

@ctate ctate merged commit 12d79e4 into main Feb 23, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] set media dark gets reset on every subsequent command

1 participant