intuit / postcss-themed

A PostCSS plugin for generating themes.
MIT License
62 stars 32 forks source link

Fix: Dark mode logic #61

Closed kharrop closed 3 years ago

kharrop commented 3 years ago

What Changed

Updating the dark mode logic to match the previous way design data was referenced, where theme-specific values should be compared back to the default theme, not to each other.

Meaning theme.light should override defaultTheme.light and theme.dark should override defaultTheme.dark (not theme.light).

You can test this by having a theme use the same value for dark and light mode. Previously, if the values were the same, the dark mode value would use the default theme dark value. This PR fixes this where the dark value for the theme will be used as expected.

Why

https://github.com/intuit/postcss-themed/pull/48 introduced some new logic that said if the dark scheme value was the same as the light value, don't include it. However, the logic should be if the dark scheme value for the default theme is the same as light, don't include it.

Updating the logic to be default theme specific, since we want to be able to supply the same value for dark and light schemes in non-default themes.

Todo:

Published PR with canary version: 2.8.1-canary.61.736

hipstersmoothie commented 3 years ago

:rocket: PR was released in v2.8.1 :rocket: