0
0
SASSmarkup~10 mins

Token-driven color palettes in SASS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a color token variable for primary color.

SASS
$primary-color: [1];
Drag options to blanks, or click blank then click option'
A#3498db
Bprimary-color
Ccolor-primary
Dblue
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of color values.
Forgetting the # in hex color codes.
2fill in blank
medium

Complete the code to use the primary color token in a CSS rule.

SASS
button {
  background-color: [1];
}
Drag options to blanks, or click blank then click option'
A$primary
Bprimary
Cprimary-color
D$primary-color
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the $ sign before the variable name.
Using incorrect variable names.
3fill in blank
hard

Fix the error in the token usage to apply a lighter shade of the primary color.

SASS
button {
  background-color: lighten([1], 20%);
}
Drag options to blanks, or click blank then click option'
AprimaryColor
Bprimary-color
C$primary-color
Dcolor-primary
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without $ inside functions.
Misspelling the variable name.
4fill in blank
hard

Fill both blanks to create a token-driven palette map with primary and secondary colors.

SASS
$color-palette: (
  primary: [1],
  secondary: [2]
);
Drag options to blanks, or click blank then click option'
A$primary-color
B$secondary-color
C#2ecc71
D#e74c3c
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without $.
Mixing up primary and secondary colors.
5fill in blank
hard

Fill all three blanks to create a function that returns a color from the palette by token name.

SASS
@function get-color($token) {
  @return map-get([1], [2]);
}

$color: get-color([3]);
Drag options to blanks, or click blank then click option'
A$color-palette
B$token
Cprimary
Dsecondary
Attempts:
3 left
💡 Hint
Common Mistakes
Using string literals instead of variables for keys.
Mixing up variable names and token names.