0
0
SASSmarkup~20 mins

Color values and manipulation in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Color Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the output color of this Sass code?
Given the Sass code below, what is the resulting color value of $result?
SASS
$base-color: #336699;
$result: lighten($base-color, 20%);
A#6699cc
B#2a527f
C#99ccff
D#19334d
Attempts:
2 left
💡 Hint
The lighten function makes the color closer to white by the given percentage.
🧠 Conceptual
intermediate
2:00remaining
Which Sass function adjusts transparency?
Which Sass function below changes the transparency (alpha) of a color without altering its RGB values?
Aopacity($color, 0.5)
Btransparentize($color, 0.5)
Crgba($color, 0.5)
Dalpha($color, 0.5)
Attempts:
2 left
💡 Hint
Look for the function that reduces opacity by a given amount.
selector
advanced
2:00remaining
Which Sass code produces a color 30% darker than #ffcc00?
Select the Sass code snippet that correctly creates a color 30% darker than #ffcc00.
A$dark-color: darken(#ffcc00, 30%);
B$dark-color: lighten(#ffcc00, 30%);
C$dark-color: adjust-color(#ffcc00, $lightness: -30%);
D$dark-color: saturate(#ffcc00, 30%);
Attempts:
2 left
💡 Hint
Darken reduces lightness, lighten increases it.
rendering
advanced
2:00remaining
What color does this Sass code output?
What is the resulting color of $final-color after running this Sass code?
SASS
$color1: #123456;
$color2: #654321;
$final-color: mix($color1, $color2, 25%);
A#4a3f2a
B#3b3b3b
C#5a4b3c
D#2a3f4a
Attempts:
2 left
💡 Hint
The mix function blends colors weighted by the third parameter.
accessibility
expert
3:00remaining
Which Sass code ensures text color has enough contrast on a background?
Given a background color $bg, which Sass code correctly sets $text-color to black or white depending on contrast for accessibility?
SASS
$bg: #abcdef;
$text-color: ???
A$text-color: if(lightness($bg) > 50%, black, white);
B$text-color: if(darken($bg, 50%), black, white);
C$text-color: if(saturate($bg, 50%), black, white);
D$text-color: if(opacity($bg) > 0.5, black, white);
Attempts:
2 left
💡 Hint
Lightness helps decide if background is light or dark.