MetaMask / design-tokens

Design tokens to be used throughout MetaMask products
https://metamask.github.io/design-tokens/?path=/docs/getting-started-introduction--docs
26 stars 15 forks source link

Implement Flexible Theme Switching with `data-theme` Attribute for Light and Dark Modes #626

Closed georgewrmarshall closed 6 months ago

georgewrmarshall commented 6 months ago

Description

We've encountered a limitation in our current design token CSS implementation that affects the dynamic switching between light and dark themes. Specifically, our setup allows for theme changes using data-theme="dark" to adjust CSS variable values for dark mode, but there's no equivalent mechanism for light mode. This means that changing the mode of a parent element and its children to light mode dynamically (using something like data-theme="light") does not work as expected, since the default light mode styles are defined at the root level without a corresponding data attribute selector.

SCR-20240215-ulnq

Technical Details

Acceptance Criteria

Proposed Solution

Additional Notes

This change is crucial for supporting dynamic theme changes within our application, enhancing the user experience by allowing for more granular control over appearance settings. It's important to thoroughly test the implementation to ensure compatibility and consistency across all components and sections of the application.