Customizing for your brand
Change colors, type and components safely, with checks and AI guidance that come with every install.
tdpxl is a base. Once installed, the components are your code: change the brand, the copy and even the behavior. What tdpxl ships alongside each component helps you keep it usable and accessible while you do.
What every install brings
When you run npx @tdpxl/cli init or add, besides the component itself you get:
| File | What it is for |
|---|---|
components/ui/<name>.meta.json | Usage guidance for the component: when to use it, its parts, keyboard/pointer/touch behavior, responsive behavior, content guidelines, and what is safe to change versus what to re-check after changing. Yours to edit. |
tdpxl/rules.json | The rules tdpxl check uses: semantic contrast pairs for both themes and style rules. |
AGENTS.md (managed section) | Instructions for coding agents (Claude, Cursor, Copilot and others that read AGENTS.md): where things are, conventions, and to run tdpxl check after changes. Only the section between the tdpxl:agents markers is managed; the rest of the file is yours. Skip it with --skip-agents. |
Change the brand
- Keep the managed theme section as it is (between
tdpxl:theme:startandtdpxl:theme:end).tdpxl update themerefreshes it (merging any edits made inside it); overrides after the end marker never need merging. - Add your own blocks after it and override role values:
/* after tdpxl:theme:end */
:root {
--primary-base: oklch(0.55 0.2 30);
}
.dark {
--primary-base: oklch(0.75 0.16 30);
}- Run the check:
npx @tdpxl/cli checkWhat tdpxl check does
- Contrast: recomputes every semantic pair in both themes from your actual CSS (hex, rgb, hsl and oklch; alpha is composited over the surface): text pairs at 4.5:1, focus outlines and control boundaries at 3:1.
- Suggestions: for a brand role that fails, it proposes the nearest value with the same hue and chroma that passes every pair the role takes part in.
- Style rules: flags raw palette classes (
bg-blue-500),dark:variants and hex classes in installed components; dark mode works by remapping roles. - Exits with code 1 on failure, so it can run in CI.
--jsonprints a machine-readable report for tools and agents.check contrastorcheck rulesruns one group.
Contrast · light 27/33 pairs pass
✖ primary-base on white-0 (text): 1.41:1, needs 4.5:1
✖ white-0 on primary-base (text): 1.41:1, needs 4.5:1
Suggested values (same hue and chroma, nearest lightness that passes every pair)
:root { --primary-base: oklch(0.502 0.182 99.8); } was #f5d90aTry values before changing anything
Storybook includes tdpxl / Customize / Theme check: type brand values, see
every pair pass or fail live in the current theme, preview real components with
your values, apply the suggested value and copy the CSS for your project. It
uses the same pairs and math as tdpxl check.
Change a component
- Open its
.meta.json.customization.safelists what you can change freely;customization.verifypairs each kind of change with the check to run afterwards (for example: changing a size → keep a 24×24 target). - Edit the component.
- Run
npx @tdpxl/cli check. - If you changed behavior or the API, update the
.meta.jsonso your team and its AI tools keep accurate guidance. It is your copy: adapt the wording, add your own rules, remove what does not apply.
What automation does not cover
Checks compute contrast and scan code; they do not replace a keyboard pass, a screen-reader pass (VoiceOver, NVDA), or a design review.