Adaptive Themes
Themes are built in, and adaptive by default.
Themes are a first class citizen in BaseLayer and are adaptive by default.
When running the init command, a global.css file is edited or created, as well as an updated tailwind.config. By doing that themes powered by CSS Variables can be installed and ready to use.
The idea behind adaptive theming is that setting a color to bg-primary via css variable will allow the color to be switched automatically depending on what theme is set!
Default Themes
Conventions
The theme conventions consist of
- surface(1-4) - used for backgrounds
- border, input, focus
- fg(1-6) - usually grays, use for foreground text hierarchy
- primary and primary-fg - your main brand color and its foreground color
- secondary and secondary-fg - your secondary brand color and its foreground color
- positive and positive-fg - used to indicate things like success, positive trends, completions, etc.
- warning and warning-fg - used to draw caution
- critical and critical-fg - used to signal danger, or any type of descrutcive action
Changing Themes
The themes are set via [data-theme=“light”] [data-theme=“dark”], etc.
A good way to change themes is to use a library like Theme-change or Next-Themes