I am currently implementing dark/light theme variants with Aura, based on company design tokens and custom styling.
My current setup looks like this:
tokens.cssdefines base tokens such as color scales, spacing, typography, radius, etc.theme.cssmaps these tokens to semantic variables like surface, text, background, accent,error, success, etc. for both light and dark variantsstyles.cssuses these semantic variables to override Aura defaultstailwind-custom.cssalso consumes the semantic variables fromtheme.cssand is used for utility-based styling with Tailwind
So the idea is:
tokens → semantic theme variables → Aura overrides + Tailwind usage
Now I am facing the following problem.
I want to style a specific part of the application, for example only the drawer (without the navbar), with dark mode styling, while the rest of the application stays in light mode.
Additionally, if the whole application is already in dark mode, I still want full control over rendering specific sections explicitly in light or dark mode.
In the Vaadin Create 2025 presentation Aura & new theming in Vaadin 25 around minute 29, it is mentioned that individual sections can be rendered in light or dark mode independently.
Question 1
How can I render a specific area (for example Drawer, VerticalLayout, or another container) in a fixed color scheme independently from the global theme?
The goal is to render that section always in dark or always in light mode without redefining all theme-specific variables again for that area.
What is the recommended Aura-compatible approach for this?
Question 2
Does the following theme structure align with current Vaadin 25 + Aura best practices, or should this generally be structured differently?
src/main/resources/META-INF/resources/
│
├── tokens.css
│ Base design tokens
│ (color scales, spacing, typography, radius, shadows, etc.)
│
├── theme.css
│ Semantic theme variables
│ (surface, text, background, accent, interaction states)
│ mapped from tokens for light/dark variants
│
├── styles.css
│ Aura variable overrides
│ and global application styling
│
src/main/frontend/
│
└── tailwind-custom.css
for utility styling
Example css
tokens.css
:root {
--my-neutral-0: #ffffff;
--my-neutral-50: #f8fafc;
--my-neutral-900: #111827;
--my-accent-400: #818cf8;
--my-accent-500: #4f46e5;
}
theme.css
:root {
--my-background-color: var(--my-neutral-50);
--my-accent-color: var(--my-accent-500);
color-scheme: light;
}
:root[theme~="dark"] {
--my-background-color: var(--my-neutral-900);
--my-accent-color: var(--my-accent-400);
color-scheme: dark;
}
styles.css
html {
--aura-background-color-light: var(--my-background-color);
--aura-background-color-dark: var(--my-background-color);
--aura-accent-color-light: var(--my-accent-color);
--aura-accent-color-dark: var(--my-accent-color);
--aura-app-layout-inset: 0px;;
}
tailwind-custom.css
@theme {
--color-background: var(--my-background-color);
--color-accent: var(--my-accent-color);
}
Is this a reasonable structure, or is there a more standard/recommended approach for Aura in Vaadin 25?