This Sass code sets a blue background. It uses invert() to make the text color easy to read on blue. The heading uses the complementary color for contrast.
complement($color) is a valid built-in Sass function.
Step 3: Check invert
invert($color) causes error: no built-in invert() function (requires @use 'sass:color' as color; color.invert($color)).
Final Answer:
$inv: invert($color); -> Option B
Quick Check:
invert() undefined without module [OK]
Hint: invert() not built-in like complement() [OK]
Common Mistakes:
Thinking invert() is valid like complement()
Assuming intuitive function names exist
Overlooking module requirements for newer functions
5. You want to create a button with a background color $btn-color and text color that is the complement of $btn-color. Which Sass code correctly sets the text color?
hard
A. color: invert($btn-color);
B. color: darken($btn-color, 50%);
C. color: lighten($btn-color, 50%);
D. color: complement($btn-color);
Solution
Step 1: Identify the goal
The text color should be the complement of the button background color for contrast.
Step 2: Choose the correct function
complement() returns the opposite color on the color wheel, ideal for contrast.
Step 3: Exclude other options
invert() not built-in; lighten/darken adjust brightness, not hue.
Final Answer:
color: complement($btn-color); -> Option D
Quick Check:
Complement gives opposite color for readable text [OK]
Hint: Use complement() for opposite color, perfect for text contrast [OK]
Common Mistakes:
Using invert() expecting perfect contrast
Lighten or darken changes brightness, not hue
Confusing complement with invert
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.