Color del tema y modo claro/oscuro. Los cambios se aplican al momento, sin recargar la página.
Elija un color: el documentador cambia al momento (igual que con los círculos de la barra superior) y se recuerda la próxima vez.
Automático sigue la preferencia del sistema operativo y cambia en vivo si el usuario la cambia.
AstrolUI expone su sistema visual como variables CSS con el prefijo --aui-. Cambian solas con el color del tema (data-aui-color) y con el modo (data-aui-mode), así que su CSS propio queda coherente sin hacer nada más.
Las variables antiguas (--color-base, --background, --layout-*...) siguen existiendo como alias de estos tokens para no romper el CSS existente.
/* 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 aplica el color (Style) y el modo (Mode). Cambie esas variables y el layout se repinta sin recargar; con AstrolThemeSwitcher el usuario lo hace desde la barra superior. Guarde la preferencia donde quiera (localStorage, perfil del usuario...).
<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;}Además de los seis colores, AstrolUI acepta cualquier color de marca. Todos los componentes de todos los paquetes (botones, formularios, tabla, menú, gráficas, tablero, editor, visor de PDF...) se pintan con tres variables: --aui-brand, --aui-brand-strong y --aui-on-brand; los tonos suaves, el anillo de foco y el resto se derivan de ellas. Con data-aui-color="custom" esas variables salen de --aui-custom-brand (y opcionalmente --aui-custom-brand-strong y --aui-custom-on-brand).
AstrolCustomTheme (Astrol.Entities.Basic) calcula las tres a partir de un solo color: la versión fuerte y el texto (blanco u oscuro) con más contraste. No hace falta AstrolThemeSwitcher: puede venir de la configuración, de la base de datos (un color por cliente) o de un campo de color. Elija un color aquí para aplicarlo a todo el documentador.
--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 */}