Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Preferred color scheme awareness #8271

Merged
merged 7 commits into from
Oct 3, 2019
Merged

UI: Preferred color scheme awareness #8271

merged 7 commits into from
Oct 3, 2019

Conversation

mathiasrando
Copy link
Contributor

Issue: #6088

What I did

  • Add awareness for preferred color scheme and set the default theme accordingly
  • Update the theming documentation to mention the awareness

How to test

  1. Use a browser that supports prefers-color-scheme
  2. Set your preferred color scheme
  3. Open a Storybook without a provided theme
    3a) Clear your localStorage and refresh the page if it's not already clean
  4. Check that it shows the dark/light theme matching your preference
  5. Change your preferred color scheme
  6. Refresh the page
  7. Check that it shows the dark/light theme matching your preference

If anyone has an idea for updating the tests for create and convert help would be greatly appreciated. Unfortunately I couldn't change the mock of watchMedia during the test and therefore updating the existing tests to account for the preferred color scheme awareness wasn't possible. I decided to leave the existing tests as they still pass since the light theme is still handled as the default.

@vercel
Copy link

vercel bot commented Oct 2, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://monorepo-git-fork-mathiasrando-preferred-color-scheme-awareness.storybook.now.sh

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fantastic. Nice tests!

@shilman shilman added this to the 5.3.0 milestone Oct 3, 2019
@shilman shilman changed the title Preferred color scheme awareness UI: Preferred color scheme awareness Oct 3, 2019
@shilman shilman merged commit 0eea02a into storybookjs:next Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants