Playwright · Middle · Question 44 of 75

How do you test dark mode styles?

Show the answer

Correct answer: test.use({ colorScheme: 'dark' })

Explanation

colorScheme emulates prefers-color-scheme, so CSS media queries respond as for a real user.

Further reading

Problem with a question

Playwright · Middle · question 44

Test yourself

Take the Playwright · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz