Blazor ux theme sync

From IntentArchitect/Intent.Modules.NET · View interactive version

Blazor ux theme sync is an AI agent skill from the GitHub repository IntentArchitect/Intent.Modules.NET. Updates ux-tokens.css to match a new or replaced design.md. Use when a design specification has changed and a standard Blazor app needs its colours, typography, spacing, radii, base styles, or native control styles refreshed without MudBlazor.

How to use this skill

Skill file

Purpose

Translate a design specification (design.md) into the standard Blazor CSS theme (ux-tokens.css). The design may use any structure or naming convention. Work from design intent and express it through the existing token and control styling system without introducing a component library dependency or changing stylesheet wiring.

This skill is for standard Blazor apps. It may style Bootstrap-compatible selectors such as .btn, .form-control, and .alert because generated standard Blazor pages use those classes and sample-page apps may load Bootstrap before the UX theme files. Do not use MudBlazor components, MudBlazor CSS selectors, or --mud-* CSS variables.

If ux-mudblazor.css exists in the target app, stop and use the mudblazor-ux-theme-sync skill instead.

MANDATORY: Read Both Files Before Changing Anything

STOP - you MUST read both files in full before writing a single line:

  1. design.md - the source of truth for the new design intent
  2. ux-tokens.css - design tokens, base styles, utility classes, standard Blazor/native control styles, aliases, and theme polarity

If any file is missing or unreadable: stop, report which file is missing, and do not proceed.

Step 1 - Extract Design Intent from design.md

The design may be a reference table, a prose brief, a Figma export, a brand guide, or another format. Extract the intent before touching CSS.

Extract the following where present:

If the design omits a category entirely, treat the existing values in the CSS file as correct and leave them unchanged.

Step 2 - Map Design Intent to ux-tokens.css

The standard Blazor theme lives in ux-tokens.css. Update only the sections affected by the design change.

| Design concept | File | Typical section |

|---|---|---|

| Brand palette / raw colour values | ux-tokens.css | Brand Palette |

| Typography scale and fonts | ux-tokens.css | Typography Scale |

| Spacing, radius, motion | ux-tokens.css | Spacing, Radius & Motion |

| Semantic colours for the default theme | ux-tokens.css | Semantic Tokens |

| Semantic colours for the alternate theme | ux-tokens.css | [data-theme="..."] override |

| Backward-compatible aliases | ux-tokens.css | Backward-compat Aliases |

| Base HTML styles | ux-tokens.css | Global Base Styles |

| Utility classes and animations | ux-tokens.css | Utility Classes / Motion |

| Forms and inputs | ux-tokens.css | Standard Form Controls |

| Buttons and links | ux-tokens.css | Buttons |

| Alerts and status messages | ux-tokens.css | Feedback & Data Display |

| Tables | ux-tokens.css | Feedback & Data Display |

| Layout helper classes | ux-tokens.css or scoped CSS | Only when already present |

If a file does not use numbered sections, map by token name, selector, and existing naming conventions.

Step 3 - Determine Change Scope

Classify every extracted design value as one of:

Do not restructure sections, reorder rules, or clean up unrelated CSS.

Step 4 - Detect Theme Polarity and Handle Dual Theme

4a - Detect Polarity

Before updating tokens, determine the default theme polarity of the existing CSS and the incoming design.

4b - Polarity Flip

If the polarities differ, a polarity flip is required:

  1. Apply the new design's default palette to :root.
  2. Rename the existing override selector globally in ux-tokens.css:
  1. Update the renamed override block with opposite-polarity token values.
  2. Check all control rules in ux-tokens.css that use [data-theme="..."] selectors.

The rename must be global across the file.

4c - No Polarity Flip

If the polarities match, update only the affected token values in each block. Do not rename selectors.

If the design specifies both dark and light variants, update both blocks independently.

Step 5 - Preserve Backward-Compatible Aliases

The --ux-* alias block in ux-tokens.css maps older names to current semantic tokens via var(...).

After updating semantic tokens:

Step 6 - Update Standard Control Styles

Use the standard control sections in ux-tokens.css for app-wide native/control styling. These selectors support standard Blazor account pages and generated standard Blazor pages.

Standard Blazor apps may or may not load bootstrap/bootstrap.min.css depending on generated settings and content. When Bootstrap is already linked, ux-tokens.css is loaded after it and acts as the app's design-system override. When Bootstrap is not linked, ux-tokens.css must still provide enough styling for these control classes to render correctly.

Supported control families include:

When updating controls:

Forbidden:

Step 7 - Apply Changes

Apply the minimum edits needed to express the new design intent.

Use in-place value replacement wherever possible.

Forbidden:

Handling Ambiguity

Definition of Done

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.