Performance: Adjust-hue for color rotation
This affects the CSS paint time and rendering speed because color adjustments can trigger repaints.
$color: #3498db; $adjusted-color: adjust-hue($color, 120deg); .element { color: $adjusted-color; background-color: $adjusted-color; border-color: $adjusted-color; }
$color: #3498db; .element { color: adjust-hue($color, 120deg); background-color: adjust-hue($color, 120deg); border-color: adjust-hue($color, 120deg); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple adjust-hue calls on same color | No extra DOM nodes | 0 | Multiple repaints | [X] Bad |
| Single adjust-hue calculation reused | No extra DOM nodes | 0 | Single repaint | [OK] Good |
What does the adjust-hue function do in Sass?
adjust-hueadjust-hue specifically rotates hue.Which of the following is the correct syntax to rotate the hue of #ff0000 by 90 degrees using adjust-hue in Sass?
?adjust-hue takes two arguments separated by a comma: the color and the degree number (without unit).deg unit in Sass.What color will be produced by this Sass code?
$color: #00ff00;
$new-color: adjust-hue($color, 120);
Choose the closest hex color output for $new-color.
#00ff00 is pure green, which is at 120° on the color wheel.Identify the error in this Sass code snippet:
$base-color: #ff00ff;
$new-color: adjust-hue($base-color 60deg);
adjust-hue must be separated by a comma; here, comma is missing.deg unit in Sass.You want to create a color palette by rotating the hue of #336699 by increments of 45 degrees four times. Which Sass code correctly generates the list of rotated colors?
?Pass the test and this pattern moves unknown