TwThemes.colorConfig(): TwColors
The TwThemes.colorConfig()
function is to be be used in the
tailwind.config.js
color section (as part of the build process).
It generates a configuration structure that defines the context colors
in-use, as defined by the Schema
contained in the
TwThemes
object.
These color definitions reference CSS Variables that are dynamically maintained (at run-time) by the active theme.
API:
+ TwThemes.colorConfig(): TwColors
Parameters: NONE
Return: TwColors
- a tailwind JSON color structure to be
referenced in the tailwind.config.js
color section.
Usage:
tailwind.config.js
==================
import TwThemes from './src/layout/colorTheme';
export default {
... snip snip
theme: {
... snip snip
extend: {
colors: TwThemes.colorConfig(), // define the context colors in-use
},
},
};
NOTE: Having trouble with this snippet, due to ES Modules? Please refer to A Note on ES Modules in Tailwind Configuration.