themestyler

1.3.6 • Public • Published

themestyler

Theme manager for you React apps.

Using HOC pattern

import {Theme, themed} from 'themestyler';

const Box = ({theme}) => {
    return <div style={{background: theme.background}}>BOX</div>;
};
const BoxThemed = themed(Box);

<Theme value={{
    color: 'red',
    background: 'green',
}}>
    <div>
        <BoxThemed/>
    </div>
</Theme>

Using FaCC pattern

import {Theme, Themed} from 'themestyler';

<Theme value={{
    color: 'red',
    background: 'green',
}}>
    <div>
        <Themed>{theme => {
            return <div style={{background: theme.background}}>BOX</div>;
        }}</Themed>
    </div>
</Theme>

You can nest multiple themes inside one another, the values will be shallowly merged.

You can specify a custom theme name using name property:

<Theme name="custom"/>
<Themed name="custom"/>
themed(Component, 'custom');

Readme

Keywords

none

Package Sidebar

Install

npm i themestyler

Weekly Downloads

1

Version

1.3.6

License

none

Last publish

Collaborators

  • streamich