Skip to content

Commit

Permalink
feat(color-mode): inject __colorMode into theme
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Sep 26, 2019
1 parent 96042ff commit ab3ad17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/colorModes.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export function useColorModeTheme(theme, mode) {
if (!hasColorModes(theme)) return theme

if (mode === getInitialColorModeName(theme)) {
return theme
return { ...theme, __colorMode: mode }
}

return {
Expand All @@ -225,6 +225,7 @@ export function useColorModeTheme(theme, mode) {
...theme.colors,
...theme.colors.modes[mode],
},
__colorMode: mode,
__rawColors: theme.colors,
}
}, [theme, mode])
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/colorModes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ describe('#useColorModeTheme', () => {
...darkTheme.colors,
...darkTheme.colors.modes.dark,
},
__colorMode: 'dark',
__rawColors: darkTheme.colors,
useCustomProperties: false,
})
Expand Down

0 comments on commit ab3ad17

Please sign in to comment.