diff --git a/docs/agents/files/role/style.css.md b/docs/agents/files/role/style.css.md index 7c64878ddf..b4e2ea7377 100644 --- a/docs/agents/files/role/style.css.md +++ b/docs/agents/files/role/style.css.md @@ -6,6 +6,7 @@ For repository wiring, inventory keys, and the generated palette contract, see [ ## Goal +- You MUST use the app's own configuration before the role stylesheet. An in-house theming, theme or custom CSS option outranks injected CSS. - You MUST add the smallest possible theming layer on top of the role's existing CSS. - You MUST prefer token mapping over selector rewrites so the role keeps its native structure. - The result MUST feel like one coherent brand theme, not a collection of unrelated overrides. @@ -16,6 +17,7 @@ For repository wiring, inventory keys, and the generated palette contract, see [ - You MUST use the semantic `--design-*` tokens listed in [Contributing `style.css`](../../../contributing/artefact/files/role/style.css.md#design-tokens-) for every color. Hard-coded colors are forbidden. - You MUST prefer semantic tokens (`--design-surface-*`, `--design-text*`, `--design-border*`, `--design-primary`, `--design-link`, status tokens) over the `--design-primary-*` and `--design-neutral-*` scales. Use a scale step only for brand accents a semantic token does not cover. - You MUST map the app's status colors onto `--design-success`, `--design-warning`, `--design-danger` and `--design-info`, and the text on filled status surfaces onto the matching `--design-on-*` token. +- You MUST map brand-colored app chrome (sidebar, masthead, top bar) onto `--design-frame`, its text and icons onto `--design-on-frame`, and its hovered and selected entries onto `--design-frame-hover` and `--design-frame-active`. `--design-primary` is the accent of controls and MUST NOT fill a large area. On the frame element you MUST set `--design-focus: var(--design-on-frame)`, and set it back to `var(--design-link)` on a surface the frame hosts (a popup, a menu). - You MUST NOT add your own `prefers-color-scheme` block for colors. The tokens switch with the mode. - If the app has its own theme switch, you MUST mirror its state onto `` from `templates/design.js.j2` so the tokens follow the app, not only the browser. @@ -37,10 +39,11 @@ For repository wiring, inventory keys, and the generated palette contract, see [ ## Workflow 1. Preserve the role's base CSS so the application styling stays intact, including its contrast relations (frame against content, panel against page, selected against unselected). -2. When the app has its own theming mechanism (config, CLI or API), feed the palette through it and ship no stylesheet. -3. Otherwise inspect which variables the role or framework already exposes (semantic tokens, palette variables, custom properties). -4. Map the design tokens onto those variables. Add selector overrides only for surfaces that cannot be reached through variables. -5. Keep transparency, text contrast, and surface hierarchy aligned. Replace upstream gradients with flat token surfaces. +2. When the app has its own theming configuration (config, CLI, API or admin setting), feed the palette through it and ship no stylesheet. +3. When the app has an in-house theme or custom CSS option (theme file, custom CSS setting), ship the mapping through that option instead of the role stylesheet. +4. Use the role stylesheet only for what no in-house option reaches. Inspect which variables the role or framework already exposes (semantic tokens, palette variables, custom properties). +5. Map the design tokens onto those variables. Add selector overrides only for surfaces that cannot be reached through variables. +6. Keep transparency, text contrast, and surface hierarchy aligned. Replace upstream gradients with flat token surfaces. The full role pass, the review gallery and the work queue are described in the [Design Loop](../../action/design.md). diff --git a/docs/contributing/artefact/files/role/style.css.md b/docs/contributing/artefact/files/role/style.css.md index 78444acb43..cfe0303bfe 100644 --- a/docs/contributing/artefact/files/role/style.css.md +++ b/docs/contributing/artefact/files/role/style.css.md @@ -9,9 +9,11 @@ For browser-side validation requirements after visible UI changes, see [Playwrig - A role ships its override as `templates/style.css.j2` or `files/style.css`. - `sys-front-inj-design` renders it when `services.design.enabled` is enabled. -- The shared element styles (`body`, links, buttons, form fields, tables, focus outline) sit in the cascade layer `infinito-design`. Every unlayered rule of the app wins over them, so they only style what the app leaves unstyled. -- An app with its own design system gets the corporate palette by mapping its CSS variables onto the tokens in the role stylesheet (see [web-app-gitea](../../../../../roles/web-app-gitea/templates/style.css.j2)), or through its own theming mechanism (Nextcloud takes the primary color, logo, name and slogan via `occ theming:config` and ships no stylesheet). -- The Bootstrap mapping in `bootstrap.css` is unlayered and applies to every Bootstrap app. +- The shared element styles (`body`, links, buttons, form fields, tables, focus outline) sit in the cascade layer `infinito-design`. `layer.css` is linked first in `
` and declares that layer before the app's own stylesheets, so every rule of the app wins over them, layered or not. They only style what the app leaves unstyled. +- The app's own configuration outranks the role stylesheet. A theming configuration carries the palette first (Nextcloud takes the primary color, logo, name and slogan via `occ theming:config` and ships no stylesheet), then an in-house theme or custom CSS option. +- An in-house theme carries a variable mapping natively (see [web-app-gitea](../../../../../roles/web-app-gitea/templates/theme.css.j2)). The role stylesheet maps the app's CSS variables onto the tokens only for what no in-house option reaches. +- The Bootstrap component mapping in `bootstrap.css` is unlayered. A role built on Bootstrap links it by setting `bootstrap: true` in its `design:` entry. Set in `web-svc-design`, the value applies to every role. +- A role stylesheet or design script that renders empty counts as absent: nothing is deployed, linked or injected for it. - A role MAY ship `templates/design.js.j2`. `sys-front-inj-design` collapses it, adds its CSP hash and injects it whenever `services.design.enabled` is enabled, independent of `services.javascript.enabled`. ## Inventory ๐ @@ -29,14 +31,17 @@ The [design_palette](../../../../../plugins/lookup/design_palette.py) lookup der | `--design-surface-1` | Page background | | `--design-surface-2` | Cards, panels, inputs | | `--design-surface-3` | Hover, selected and inset areas, table heads | -| `--design-surface-hover`, `--design-surface-active` | Hovered and pressed or open neutral controls; body text stays AAA and muted text AA on both | +| `--design-surface-hover`, `--design-surface-active` | Hovered and pressed or open neutral controls; body text stays AAA, muted text, links and status colors AA on both | | `--design-text` | Body text, AAA against every surface | | `--design-text-muted` | Secondary text, AA against every surface | | `--design-border` | Decorative dividers | -| `--design-border-strong` | Input and control boundaries, 3:1 against surfaces | -| `--design-primary` / `--design-on-primary` | Brand surfaces and the text on them | -| `--design-link` | Links and focus, AA against surfaces | -| `--design-success`, `--design-warning`, `--design-danger`, `--design-info` | Status text and icons, AA against surfaces | +| `--design-border-strong` | Input and control boundaries, 3:1 against `--design-surface-1` and `--design-surface-2` | +| `--design-primary` / `--design-on-primary` | Brand surfaces, 3:1 against `--design-surface-1` and `--design-surface-2`, and the text on them | +| `--design-frame` / `--design-on-frame` | Large brand surfaces such as a sidebar, masthead or top bar: a deep brand tone in light and dark mode, and the text on it at AAA | +| `--design-frame-hover`, `--design-frame-active` | Hovered and selected entries inside the frame; the on-color stays AAA | +| `--design-focus` | Color of the default focus outline. Unset, the outline uses `--design-link`. A frame sets it to `--design-on-frame` on its own element; every focusable it hosts then draws its outline in that color | +| `--design-link` | Links and focus, AA against every surface | +| `--design-success`, `--design-warning`, `--design-danger`, `--design-info` | Status text and icons, AA against every surface and against their own `-subtle` background | | `--design-on-