This PR addresses the need for flexible theme switching, as discussed in Issue #626. The motivation behind this change is to enhance user experience by allowing dynamic theme changes (light and dark modes) at any level of the application.
The solution involves updating our CSS to explicitly define light and dark mode variables and applying them using the data-theme attribute. This approach ensures that theme changes are seamlessly reflected across the application, regardless of the global theme setting.
Related issues
Fixes: #626
Manual testing steps
Run storybook in the extension using yarn storybook
Inspect the stylesheet of the design tokens and add ,[data-theme='light'] to root
Test the theme switch at a component level by manually adding data-theme="light" or data-theme="dark" to component containers.
Screenshots/Recordings
After
Screencast below shows theming not work but once the data attribute [data-theme='light'] dynamic theming works
[x] I've clearly explained what problem this PR is solving and how it is solved.
[x] I've linked related issues
[x] I've included manual testing steps
[x] I've included screenshots/recordings if applicable
[x] I’ve included tests if applicable
[x] I’ve documented my code using JSDoc format if applicable
[x] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
[x] I’ve properly set the pull request status:
[x] In case it's not yet "ready for review", I've set it to "draft".
[x] In case it's "ready for review", I've changed it from "draft" to "non-draft".
Pre-merge reviewer checklist
[x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
[x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Description
This PR addresses the need for flexible theme switching, as discussed in Issue #626. The motivation behind this change is to enhance user experience by allowing dynamic theme changes (light and dark modes) at any level of the application.
The solution involves updating our CSS to explicitly define light and dark mode variables and applying them using the
data-theme
attribute. This approach ensures that theme changes are seamlessly reflected across the application, regardless of the global theme setting.Related issues
Fixes: #626
Manual testing steps
yarn storybook
,[data-theme='light']
toroot
data-theme="light"
ordata-theme="dark"
to component containers.Screenshots/Recordings
After
Screencast below shows theming not work but once the data attribute
[data-theme='light']
dynamic theming workshttps://github.com/MetaMask/design-tokens/assets/8112138/7dc71a2a-1685-4c0b-8bfb-259d483630f6
Pre-merge author checklist
Pre-merge reviewer checklist