Architecture
Understand where structure ends and presentation should begin.
Theme layer
Theme changes presentation, not structure. It handles brand styling, tokens, and visual consistency without quietly rewriting component architecture behind everyone’s back.
Ask:
Is this changing presentation only?
→ Theme
Is this changing structure or behaviour?
→ Component
Is this temporary or urgent?
→ Hacks, not theme Theme should be predictable. If a visual change needs detective work to explain, the architecture is already drifting.
Theme contains colour, spacing adjustments, radius, shadows, typography presentation, and brand-level visual decisions shared across components.
Theme does not contain layout fixes, accessibility repairs, JavaScript state handling, or emergency overrides pretending not to be hacks.
Change the token, not twenty unrelated selectors. Tokens protect consistency and stop branding from becoming a treasure hunt for the correct shade of purple.
:root {
--colour-accent: #6f3cff;
--colour-surface: #ffffff;
--radius-card: 1rem;
}
@layer theme {
.product-card {
background: var(--colour-surface);
border-radius: var(--radius-card);
}
} Good theme overrides adjust presentation without rewriting the component. Prefer intentional custom properties exposed by the component instead of surprise selector overrides.
@layer theme {
.button {
--button-background: var(--colour-accent);
}
} If the theme needs to change layout or behaviour, the problem is probably in the component layer, not the theme layer.
.button {
background: purple;
}
.checkout-button {
background: #7a32ff;
}
.hero-button {
background: rgb(118 45 255);
} Random visual overrides spread inconsistency and turn brand styling into guesswork. If one button becomes purple for unclear reasons, the problem is architecture, not creativity.