Adjust Hue for Color Rotation with Sass
📖 Scenario: You are creating a simple webpage with a colored box. You want to change the color of the box by rotating its hue using Sass. This will help you understand how to use the adjust-hue function to shift colors.
🎯 Goal: Build a Sass stylesheet that defines a base color variable and uses adjust-hue to create a rotated color. Apply these colors to two boxes so you can see the original and the hue-rotated colors side by side.
📋 What You'll Learn
Create a Sass variable called
$base-color with the exact value #3498db.Create a Sass variable called
$rotated-color that uses adjust-hue to rotate $base-color by 90 degrees.Write CSS rules for two classes:
.box-original and .box-rotated.Apply
$base-color as the background color for .box-original.Apply
$rotated-color as the background color for .box-rotated.Set both boxes to have width and height of
8rem and margin of 1rem.💡 Why This Matters
🌍 Real World
Adjusting hues is useful in design systems to create color variations without picking new colors manually. It helps keep a consistent look with different moods or themes.
💼 Career
Web developers and designers often use Sass and color functions like adjust-hue to efficiently manage colors in websites and apps, improving maintainability and creativity.
Progress0 / 4 steps