Performance: Why a color system matters
MEDIUM IMPACT
Using a consistent color system affects CSS bundle size, rendering speed, and visual stability of the page.
/* Tailwind with custom color system */ // tailwind.config.js module.exports = { theme: { extend: { colors: { primary: '#1e40af', secondary: '#9333ea', alert: '#dc2626' } } } } <div class="bg-primary text-white">Hello</div> <div class="bg-secondary text-white">World</div> <div class="text-alert">Alert</div>
/* Tailwind inline colors scattered */ <div class="bg-red-500 text-white">Hello</div> <div class="bg-green-600 text-black">World</div> <div style="color:#ff0000">Alert</div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Scattered inline colors and many unique classes | Low | Multiple style recalculations | High due to inconsistent colors | [X] Bad |
| Centralized Tailwind color system | Low | Single style recalculation | Low and consistent paint | [OK] Good |