Pulling it all together
Your Context Colors (i.e. Schema
) and
Real Colors (i.e. Themes
) are closely
related within your application. Each theme maps real colors to your
context colors.
The fusion of this relationship is accomplished through the
initTwThemes()
function, which accepts both
Schema
and Themes
parameters, providing a
central place where these two aspects can be affirmed and validated.
Interestingly enough, this is the only public function promoted by
tw-themes. It however returns a TwThemes
object
which in turn promotes the remaining API. The reason for this is to
fuse the relationship between the Schema
and
Themes
.
The TwThemes
object contains functions to:
change the active theme at run-time ... see:
activateNextTheme()
,activatePriorTheme()
,activateTheme()
,toggleInvertShade()
miscellaneous API in support of the app's theme selection UI control ... see:
getActiveInvertShade()
getActiveThemeName()
,getThemes()
,auto configure the tailwind context colors in
tailwind.config.js
(part of the build process) ... see:colorConfig()
Want to see tw-themes in action? ... take a peek at the See It Live section.