Bird
Raised Fist0
SASSmarkup~20 mins

Saturate and desaturate in SASS - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Sass Color Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding saturate() function in Sass
What does the saturate($color, $amount) function do to a color in Sass?
ADecreases the color's saturation by the given amount, making colors more gray.
BIncreases the color's saturation by the given amount, making colors more vivid.
CChanges the color's brightness by the given amount.
DChanges the color's hue by the given amount.
Attempts:
2 left
💡 Hint
Think about what saturation means in colors: how intense or dull a color looks.
📝 Syntax
intermediate
1:30remaining
Correct usage of desaturate() in Sass
Which of the following Sass code snippets correctly desaturates a color by 30%?
Acolor: desaturate(#ff6600, '30%');
Bcolor: desaturate(#ff6600 30%);
Ccolor: desaturate(#ff6600, 0.3);
Dcolor: desaturate(#ff6600, 30%);
Attempts:
2 left
💡 Hint
Check the syntax for function arguments in Sass: commas and units matter.
❓ rendering
advanced
2:00remaining
Visual effect of saturate() on a color
Given the Sass code below, what will be the visual difference between the two boxes in a browser?
SASS
$base-color: #6699cc;
.box1 {
  background-color: $base-color;
  width: 100px;
  height: 100px;
}
.box2 {
  background-color: saturate($base-color, 40%);
  width: 100px;
  height: 100px;
}
AThe second box will have a more vivid blue color than the first box.
BThe second box will be lighter in color than the first box.
CThe second box will be gray while the first box is blue.
DBoth boxes will look exactly the same.
Attempts:
2 left
💡 Hint
Saturation affects how intense or dull a color looks, not brightness or hue.
❓ selector
advanced
2:00remaining
Using desaturate() with CSS variables in Sass
Which Sass code correctly desaturates a CSS variable color by 20%?
SASS
:root {
  --main-color: #e67e22;
}
.element {
  color: ???;
}
Acolor: desaturate(#e67e22, 20%);
Bcolor: desaturate(var(--main-color), 20%);
Ccolor: desaturate($main-color, 20%);
Dcolor: desaturate(var(--main-color 20%));
Attempts:
2 left
💡 Hint
Sass functions work with Sass variables or direct colors, not CSS variables inside functions.
❓ accessibility
expert
2:30remaining
Accessibility impact of using saturate() and desaturate()
Which statement best explains how increasing saturation with saturate() affects color accessibility for users with color vision deficiencies?
AIncreasing saturation always improves accessibility by making colors easier to distinguish.
BIncreasing saturation reduces contrast and makes colors harder to see for everyone.
CIncreasing saturation can improve contrast but may not help users with certain types of color blindness.
DSaturation changes do not affect accessibility or color perception.
Attempts:
2 left
💡 Hint
Think about how color blindness affects perception of color intensity and contrast.

Practice

(1/5)
1. What does the saturate() function do to a color in Sass?
easy
A. Makes the color darker
B. Makes the color more vivid and bright
C. Makes the color lighter
D. Makes the color more transparent

Solution

  1. Step 1: Understand the purpose of saturate()

    The saturate() function increases the intensity of the color's saturation, making it look more vivid.
  2. Step 2: Compare with other effects

    Unlike darkening or lightening, saturate specifically boosts color brightness and vividness.
  3. Final Answer:

    Makes the color more vivid and bright -> Option B
  4. Quick Check:

    saturate() = more vivid color [OK]
Hint: Saturate = boost color brightness and vividness [OK]
Common Mistakes:
  • Confusing saturate() with lighten() or darken()
  • Thinking saturate() changes transparency
  • Assuming saturate() makes color dull
2. Which of the following is the correct syntax to desaturate a color by 20% in Sass?
easy
A. desaturate(#ff0000, 0.2)
B. desaturate(#ff0000 20%)
C. desaturate(#ff0000, 20%)
D. desaturate(#ff0000; 20%)

Solution

  1. Step 1: Recall the function syntax

    The desaturate() function takes two arguments separated by a comma: the color and the percentage to reduce saturation.
  2. Step 2: Identify correct punctuation and units

    The percentage must have a percent sign (%) and be separated by a comma, so desaturate(#ff0000, 20%) is correct.
  3. Final Answer:

    desaturate(#ff0000, 20%) -> Option C
  4. Quick Check:

    Correct syntax uses comma and percent sign [OK]
Hint: Use comma and % for saturation amount [OK]
Common Mistakes:
  • Omitting the comma between arguments
  • Using decimal instead of percentage
  • Using semicolon instead of comma
3. What color will this Sass code produce?
$color: #6699cc;
$new-color: saturate($color, 30%);
medium
A. A more vivid blue than #6699cc
B. #6699cc (unchanged)
C. A duller, grayer blue than #6699cc
D. A lighter blue than #6699cc

Solution

  1. Step 1: Understand saturate effect on #6699cc

    The color #6699cc is a medium blue. Applying saturate($color, 30%) increases its saturation, making it more vivid.
  2. Step 2: Compare options

    A more vivid blue than #6699cc correctly describes the result. The unchanged option is incorrect because the color changes. The duller, grayer option is incorrect because saturate increases vividness. The lighter blue option is incorrect because saturate does not lighten the color.
  3. Final Answer:

    A more vivid blue than #6699cc -> Option A
  4. Quick Check:

    saturate() = more vivid color [OK]
Hint: Saturate makes colors brighter, not lighter or duller [OK]
Common Mistakes:
  • Thinking saturate lightens the color
  • Assuming saturate makes color duller
  • Believing color stays unchanged
4. Identify the error in this Sass code:
$color: #00ff00;
$new-color: desaturate $color 50%;
medium
A. Function name should be saturate, not desaturate
B. Incorrect color format
C. Percentage value should be a decimal
D. Missing parentheses around function arguments

Solution

  1. Step 1: Check function call syntax

    In Sass, functions require parentheses around their arguments. The code misses parentheses around $color and 50%.
  2. Step 2: Verify other parts

    The color format #00ff00 is valid, and the percentage is correctly given as 50%. The function name desaturate is correct for reducing saturation.
  3. Final Answer:

    Missing parentheses around function arguments -> Option D
  4. Quick Check:

    Functions need parentheses [OK]
Hint: Always use parentheses for Sass functions [OK]
Common Mistakes:
  • Omitting parentheses in function calls
  • Confusing saturate and desaturate functions
  • Using decimal instead of percentage
5. You want to create a button style that uses a base color #ff6600 but looks less intense on hover by reducing saturation by 40%. Which Sass code correctly achieves this?
hard
A. $base-color: #ff6600; button { background-color: $base-color; &:hover { background-color: desaturate($base-color, 40%); } }
B. $base-color: #ff6600; button { background-color: $base-color; &:hover { background-color: saturate($base-color, 40%); } }
C. $base-color: #ff6600; button { background-color: $base-color; &:hover { background-color: desaturate($base-color 40%); } }
D. $base-color: #ff6600; button { background-color: $base-color; &:hover { background-color: lighten($base-color, 40%); } }

Solution

  1. Step 1: Identify the goal

    The button's hover state should have the base color with 40% less saturation, so desaturate($base-color, 40%) is needed.
  2. Step 2: Check syntax and logic

    $base-color: #ff6600; button { background-color: $base-color; &:hover { background-color: desaturate($base-color, 40%); } } uses correct syntax with parentheses and comma, and applies desaturate correctly on hover. $base-color: #ff6600; button { background-color: $base-color; &:hover { background-color: saturate($base-color, 40%); } } incorrectly saturates instead of desaturates. $base-color: #ff6600; button { background-color: $base-color; &:hover { background-color: desaturate($base-color 40%); } } misses the comma between arguments. $base-color: #ff6600; button { background-color: $base-color; &:hover { background-color: lighten($base-color, 40%); } } uses lighten, which changes brightness, not saturation.
  3. Final Answer:

    Code with desaturate($base-color, 40%) and correct syntax -> Option A
  4. Quick Check:

    Desaturate with parentheses and comma [OK]
Hint: Use desaturate(color, %) with parentheses and comma [OK]
Common Mistakes:
  • Using saturate instead of desaturate
  • Omitting comma between arguments
  • Using lighten instead of desaturate
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard