Challenge - 5 Problems
Color Mastery with Complement and Invert
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding the complement function in Sass
What does the
complement() function do when applied to a color in Sass?Attempts:
2 left
💡 Hint
Think about colors opposite each other on a color wheel.
✗ Incorrect
The
complement() function returns the complementary color, which is the color opposite on the color wheel. This is useful for creating contrasting color schemes.📝 Syntax
intermediate2:00remaining
Using the invert function in Sass
What is the output color of this Sass code?
$color: #123456; $result: invert($color);
SASS
$color: #123456; $result: invert($color);
Attempts:
2 left
💡 Hint
Invert flips each RGB channel by subtracting from 255.
✗ Incorrect
The invert function subtracts each RGB channel from 255. For #123456 (18,52,86), invert is (237,203,169) which is #edcba9.
❓ rendering
advanced2:00remaining
Visual effect of complement and invert combined
If you apply
invert(complement($color)) to a color in Sass, what is the visual result compared to the original color?Attempts:
2 left
💡 Hint
Think about the order of operations and how complement and invert affect colors differently.
✗ Incorrect
Applying invert to the complement produces a new color that is not the original or a simple complement or invert. The operations do not cancel each other out.
❓ selector
advanced2:00remaining
Selecting elements with complementary colors in Sass
Which Sass selector syntax correctly applies a style to elements whose background color is the complement of
$base-color?SASS
$base-color: #3498db; // Which selector applies styles to elements with background color complement of $base-color?
Attempts:
2 left
💡 Hint
Remember Sass interpolation syntax inside selectors.
✗ Incorrect
To use a function result inside a selector attribute value, you must interpolate it with #{...}. Option A correctly interpolates the complement color.
❓ accessibility
expert3:00remaining
Ensuring accessibility when using complement and invert colors
When using
complement() and invert() functions in Sass to style text and backgrounds, what is the best practice to maintain accessibility?Attempts:
2 left
💡 Hint
Think about users with vision impairments and color blindness.
✗ Incorrect
Complement and invert colors can sometimes produce poor contrast. Checking contrast ratios ensures text is readable and accessible to all users.