react-redux-theme-provider
React helpers for theming components. Works great with inline styles or any css-in-js library.
Installation
React 15.3.0 and Redux 3.0.0 or later are peer dependencies.
npm install --save react-redux-theme-provider
Usage
import { withTheme, ThemeProvider } from 'react-redux-theme-provider'
function MyApp({ theme }) {
return (
<ThemeProvider theme={theme}>
<MyThemedComponent />
</ThemeProvider>
)
}
export default withTheme({
primaryColor: 'blue'
})
export default withTheme(props => {
primaryColor: props.primaryColor
})
import { withStyles } from 'react-redux-theme-provider'
function MyThemedComponent({ styles }) {
return (
<div style={styles.base} />
)
}
export default withStyles(theme => ({
base: {
background: theme.primaryColor
}
}))(MyThemedComponent)