Theme color and light/dark mode. Changes apply right away, without reloading the page.
Pick a color: the docs change right away (same as the circles in the top bar) and it is remembered next time.
Automatic follows the operating system preference and changes live when the user changes it.
AstrolUI exposes its visual system as CSS variables with the --aui- prefix. They change by themselves with the theme color (data-aui-color) and the mode (data-aui-mode), so your own CSS stays consistent without extra work.
The old variables (--color-base, --background, --layout-*...) still exist as aliases of these tokens so existing CSS keeps working.
/* Use the tokens in your own CSS: they follow the theme color and light/dark mode */.my-card { background: var(--aui-surface); border: 1px solid var(--aui-border); border-radius: var(--aui-radius-lg); box-shadow: var(--aui-shadow-sm); color: var(--aui-text);}.my-card small { color: var(--aui-text-2); }.my-card .highlight { background: var(--aui-brand-soft); color: var(--aui-brand-text); }.my-card .action { background: var(--aui-brand); color: var(--aui-on-brand); } /* Your own brand color: override it in a theme */[data-aui-color="blue"] { --aui-brand: #0057b8; --aui-brand-strong: #003f86; --aui-on-brand: #fff; }AstrolLayoutMenu applies the color (Style) and the mode (Mode). Change those variables and the layout repaints without reloading; with AstrolThemeSwitcher the user does it from the top bar. Save the preference wherever you want (localStorage, user profile...).
<AstrolLayoutMenu Style="@theme" Mode="@mode" OnChangeThemeMode="m => mode = m"> <Top> <AstrolThemeSwitcher @bind-Theme="theme" @bind-Mode="mode" /> </Top> ...</AstrolLayoutMenu> @code { private AstrolTheme theme = AstrolTheme.Yellow; private AstrolThemeMode mode = AstrolThemeMode.Auto;}Besides the six colors, AstrolUI accepts any brand color. Every component of every package (buttons, forms, table, menu, charts, board, editor, PDF viewer...) is painted with three variables: --aui-brand, --aui-brand-strong and --aui-on-brand; soft shades, the focus ring and the rest derive from them. With data-aui-color="custom" those variables come from --aui-custom-brand (and optionally --aui-custom-brand-strong and --aui-custom-on-brand).
AstrolCustomTheme (Astrol.Entities.Basic) computes all three from a single color: the strong shade and the text color (white or dark) with the most contrast. AstrolThemeSwitcher is not required: the color can come from settings, the database (one color per customer) or a color field. Pick a color here to apply it to the whole documentation.
--aui-custom-brand: #0ea5e9; --aui-custom-brand-strong: #0b81b6; --aui-custom-on-brand: #1c1917; @* 1. With AstrolLayoutMenu: Style = Custom + CustomColor (also applied to <html>) *@<AstrolLayoutMenu Style="AstrolTheme.Custom" CustomColor="#0ea5e9" Mode="@mode"> ... </AstrolLayoutMenu> @* 2. On any container (or <html>), without the layout *@<div data-aui-color="custom" style="@AstrolCustomTheme.GetStyle(brandColor)"> <AstrolButton Text="Save" /> @* buttons, grid, toggles, charts... use the color *@</div> @* 3. For the whole app from C# (e.g. the color of each customer, read from the database) *@<HeadContent><style>@AstrolCustomTheme.GetCss(tenant.BrandColor)</style></HeadContent><!-- and data-aui-color="custom" on <html> -->/* CSS only: one variable is enough (the strong shade and the text color have defaults) */:root { --aui-custom-brand: #0ea5e9; } /* Or a named theme of your own: data-aui-color="acme" */[data-aui-color="acme"] { --aui-brand: #0f766e; /* buttons, focus, selection, active menu item */ --aui-brand-strong: #115e59; /* hover and text over light backgrounds */ --aui-on-brand: #ffffff; /* text on top of the color */}