Performance: Lighten and darken functions
LOW IMPACT
These functions affect CSS rendering by changing color values, impacting paint and composite stages during style updates.
$primary-color: #3498db; $primary-dark: #2a80b9; // precomputed darkened color $primary-darker: #1f5f82; // precomputed darker color .button { background-color: $primary-dark; border-color: $primary-darker; }
$primary-color: #3498db; .button { background-color: darken($primary-color, 20%); border-color: darken($primary-color, 30%); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Repeated lighten/darken calls in CSS | 0 | 0 | Increases paint cost due to larger CSS and style recalculations | [X] Bad |
| Precomputed color variables | 0 | 0 | Minimal paint cost with smaller CSS and simpler style calculations | [OK] Good |