Theming
Last updated
Last updated
Frontend Accelerator uses for theming, configured through the appConfig.ts
file. This file specifies the theme name, for both the main website theme and also (auth page) theme.
Use semantic color tokens like primary
, secondary
, accent
, neutral
, rather than specific color values (e.g., #ff0000, or text-red-600
). This makes it easier to switch themes without changing multiple styles.
DaisyUI themes handle light and dark modes automatically, making customization simpler.
NextAuth UI elements also adopt the theme specified in appConfig.ts
You can customize themes via tailwind.config.ts
and DaisyUI settings.
Check out all available themes:
To customize the theme colors in DaisyUI, you need to update tailwind.config.ts
In here you can overwrite different properties such as "primary" color. This way, generated classes, such as text-primary
, bg-primary
etc., will contain the overwritten value.
To programmatically change a theme, you need to first make sure it's registered within DaisyUI inside tailwind.config.ts
file. In this case we want to switch between "emerald" and "autumn".
To switch between them dynamically, you need to set the data-theme
attribute, to the theme you want. For example:
While there are light or dark theme variants, they don't have it's own respective light or dark mode variant. Example, if you choose "emerald" there is no "emerald dark" equivalent. But you can achieve this by either:
switching to a different theme, or a default DaisyUI dark
or light
theme
or by modifying a current theme by creating it's dark or light equivalent
Example of creating a custom light theme from "dracula"