0
0
SASSmarkup~20 mins

Color scale generation in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Color Scale Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
1:30remaining
What is the output color of this Sass function call?
Given the Sass function lighten($color, $amount), what is the resulting color when you run lighten(#336699, 20%)?
SASS
$color: #336699;
$result: lighten($color, 20%);
A#6699cc
B#4d80b3
C#1a334d
D#99ccff
Attempts:
2 left
💡 Hint
Lighten increases the brightness by the given percentage.
🧠 Conceptual
intermediate
1:00remaining
How many colors are generated by this Sass loop?
Consider this Sass code that generates a color scale by darkening a base color in 5 steps:
$base-color: #ff6600;
@for $i from 1 through 5 {
  $shade: darken($base-color, $i * 10%);
}
How many distinct colors does this loop create?
SASS
$base-color: #ff6600;
@for $i from 1 through 5 {
  $shade: darken($base-color, $i * 10%);
}
A4
B6
C10
D5
Attempts:
2 left
💡 Hint
The loop runs from 1 to 5 inclusive.
selector
advanced
2:00remaining
Which Sass selector generates a color scale class list correctly?
You want to create CSS classes named .color-1 to .color-5 each with a different shade of blue. Which Sass code snippet correctly generates these classes with increasing lightness?
SASS
$base: #0000ff;
@for $i from 1 through 5 {
  .color-#{$i} {
    color: lighten($base, $i * 10%);
  }
}
A
@each $i in 1 2 3 4 5 {
  .color-#{$i} {
    color: lighten($base, $i * 10%);
  }
}
B
@for $i from 1 through 5 {
  .color-#{$i} {
    color: lighten($base, $i * 10%);
  }
}
C
@while $i <= 5 {
  .color-#{$i} {
    color: lighten($base, $i * 10%);
  }
  $i: $i + 1;
}
D
@for $i from 0 through 4 {
  .color-#{$i} {
    color: lighten($base, $i * 10%);
  }
}
Attempts:
2 left
💡 Hint
Remember Sass @for loops can use 'from' and 'through' to include both ends.
layout
advanced
1:30remaining
What visual result does this Sass grid color scale produce?
This Sass code creates a grid of colored squares with a color scale from red to yellow. What will the user see?
SASS
$colors: (red, orange, yellow);
.container {
  display: grid;
  grid-template-columns: repeat(3, 5rem);
  gap: 1rem;
}
@each $color in $colors {
  .box-#{$color} {
    background-color: $color;
    width: 5rem;
    height: 5rem;
  }
}
AThree squares overlapping each other with mixed colors.
BA single column of three squares stacked vertically with colors red, orange, yellow.
CThree colored squares in a row: red, orange, yellow, each 5rem by 5rem with 1rem gap.
DNo visible squares because the classes are not applied.
Attempts:
2 left
💡 Hint
Grid with 3 columns and gap means squares appear side by side with space.
accessibility
expert
2:30remaining
Which Sass color scale approach best improves accessibility for colorblind users?
You want to create a color scale for a website that is friendly for users with color vision deficiencies. Which Sass approach below best supports accessibility?
AUse a color scale with varying lightness and saturation but keep hue constant, combined with text labels.
BUse only grayscale colors without any hue variation.
CUse random colors for each scale step to ensure variety.
DUse only bright red to green colors in the scale without text labels.
Attempts:
2 left
💡 Hint
Accessibility means colors should be distinguishable even if hue perception is limited.