Skip to content

Allow setting browser to dark theme in configuration #8947

Description

@Piratux

Clear and concise description of the problem

Every time I run browser tests, I manually click Toggle to dark mode when browser pops up.

Image

It would be nice if I could set in configuration to always set it to dark theme for me.

Suggested solution

There could be configuration setting browser.theme that allows setting preferred theme.
Possible values could be 'light' or 'dark'.
Default value could remain 'light'.

    test: {
      browser: {
        theme: 'dark'
      },
    },

Alternative

No response

Additional context

No response

Validations

Activity

  1. added theissue type on Nov 5, 2025
  2. selimhex commented on Nov 19, 2025

    @selimhex

    oh yes please!

  3. semihher commented on Dec 10, 2025

    @semihher

    please please please

  4. paralin commented on Dec 22, 2025

    @paralin

    +1 on this one! - and respect the os dark mode setting - prefers-color-scheme

  5. ItsJustRuby commented on Dec 27, 2025

    @ItsJustRuby
    Contributor

    UI mode currently uses vueuse/core's useDark.

    The docs there say it should already use the users' system preferences, so it would be a good starting point to investigate why that is not happening.

    There is also usePreferredDark, although from skimming the docs, it is unclear how that differs in intended behavior or usage 🙃.

  6. macarie commented on Dec 29, 2025

    @macarie
    Member

    The UI respects prefers-color-scheme, but Playwright sets it by default to "light" to be consistent across different systems.

    If you want to let the OS control this, you have to set colorScheme to null:

    test: {
      browser: {
        provider: playwright({
          contextOptions: {
            colorScheme: null,
          },
        }),
      },
    }

    Alternatively set it to "dark" to enable dark mode automatically.

    I'm not sure how WebdriverIO handles this.

  7. paralin commented on Dec 31, 2025

    @paralin

    I did it with this -

            // Force dark mode for Vitest UI
            orchestratorScripts: [
              {
                content: `localStorage.setItem('vueuse-color-scheme', 'dark')`,
                type: 'module',
              },
            ],
    

    and

            provider: playwright({
              launchOptions: {
                headless: !showUI,
              },
              contextOptions: {
                // Force dark mode for Vitest UI and tests
                colorScheme: 'dark',
              },
            }),
    
  8. locked and limited conversation to collaborators on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions