package
React styling with base16 color scheme support
npm install react-base16-stylingGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
React styling with base16 color scheme support
Inspired by react-themeable, this utility provides flexible theming for your component with base16 theme support.
yarn add react-base16-stylingimport { createStyling } from 'react-base16-styling';
import base16Themes from './base16Themes';
function getStylingFromBase16(base16Theme) {
return {
myComponent: {
backgroundColor: base16Theme.base00,
},
myComponentToggleColor({ style, className }, clickCount) {
return {
style: {
...style,
backgroundColor: clickCount % 2 ? 'red' : 'blue',
},
};
},
};
}
const createStylingFromTheme = createStyling(getStylingFromBase16, {
defaultBase16: base16Themes.solarized,
createStylingfunction(getStylingFromBase16, defaultStylingOptions, themeOrStyling)| Argument | Signature | Description |
|---|---|---|
getStylingFromBase16 | function(base16Theme) | creates object with default stylings for your component, using provided base16 theme. |
defaultStylingOptions | { defaultBase16, base16Themes } | optional parameters, allow to set default base16 theme and additional base16 themes for component. |
themeOrStyling | string or object | base16 theme name, base16 theme object or styling object. Theme name can have a modifier: "themeName:inverted" to invert theme colors (see [[#invertTheme]]) |
Styling object values could be: - objects (treated as style definitions) - strings (class names) - functions (they may be provided with additional parameters and should return object { style, className })
getBase16Themefunction(themeOrStyling, base16Themes)Helper method that returns base16 theme object if themeOrStyling is base16 theme name or theme object.
invertBase16Themefunction(base16Theme)Helper method that inverts base16 theme colors, creating light theme out of dark one or vice versa.
invertThemefunction(theme)Helper method that inverts a theme or styling object to be passed into the themeOrStyling parameter of createStyling.
Estimated unpacked size across 8 packages.
2.8 MB
Includes dependencies.
alexkuz
alexkuz@gmail.com
^3.1.3
3.2.3
^4.17.21
4.18.1
^4.17.0
4.17.27