Performance: Custom color themes
Custom color themes affect the CSS bundle size and rendering speed by adding or overriding CSS variables and styles.
:root { --bs-primary: #123456; }:root { --bs-primary: #123456; } .btn-primary { background-color: #123456 !important; } .navbar { background-color: #123456 !important; }| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple !important color overrides | Low | 0 | Medium (due to style recalculation) | [X] Bad |
| Single CSS variable override for theme color | Low | 0 | Low | [OK] Good |
:root { --bs-primary: #ff5733; }
.btn-primary { background-color: var(--bs-primary); }:root {
--bs-primary: #28a745
}
.btn-primary {
background-color: var(--bs-primary);
}Pass the test and this pattern moves unknown