AstrolUI AstrolUI
Amarillo Naranja Rojo Verde Azul Morado Color propio
Modo claro
Tema

Color del tema y modo claro/oscuro. Los cambios se aplican al momento, sin recargar la página.

1. Color del tema

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.

2. Modo

Automático sigue la preferencia del sistema operativo y cambia en vivo si el usuario la cambia.

3. Tokens de diseño

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.

  • Superficies: --aui-bg (fondo de la página), --aui-surface (tarjetas, campos), --aui-surface-2 (cabeceras, pies), --aui-surface-hover.
  • Texto: --aui-text, --aui-text-2 (secundario), --aui-text-3 (ayudas, iconos discretos); --aui-link.
  • Bordes: --aui-border, --aui-border-strong.
  • Marca: --aui-brand, --aui-brand-strong, --aui-on-brand (texto sobre la marca), --aui-brand-soft (tinte), --aui-brand-text (texto sobre el tinte), --aui-brand-ring y --aui-focus-ring (foco).
  • Estados: --aui-danger, --aui-success, --aui-warning, --aui-info.
  • Forma y movimiento: --aui-radius-sm / --aui-radius / --aui-radius-lg / --aui-radius-pill (6 / 8 / 12 / 999 px), --aui-h-control (38 px), --aui-shadow-sm / --aui-shadow / --aui-shadow-lg, --aui-dur, --aui-ease.
  • Tipografía: --aui-font, --aui-font-mono, --aui-text-xs / sm / md / lg / xl (12 / 13 / 14 / 16 / 20 px).

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; }

4. Cambiar el tema en su aplicación

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;
}

5. Tema propio

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 */
}
Markdown para IA © 2026 AstrolUI v10.0.13