Complete the code to set the background color to a light gray using a hex value.
body {
background-color: [1];
}The hex code #ccc is a shorthand for light gray color.
Complete the code to darken the color #6699cc by 20%.
$color: #6699cc; $dark-color: darken($color, [1]); .box { background-color: $dark-color; }
The darken() function reduces lightness by the given percentage. Here, 20% darkens the color noticeably.
Fix the error in the code to make the color semi-transparent with 50% opacity.
$base-color: #ff0000; $transparent-color: rgba($base-color, [1]); .button { background-color: $transparent-color; }
The rgba() function expects the alpha value as a decimal between 0 and 1, so 0.5 means 50% opacity.
Fill both blanks to create a color that is 30% lighter and has 70% opacity.
$color: #336699; $light-color: [1]($color, 30%); $final-color: rgba($light-color, [2]); .card { background-color: $final-color; }
darken() instead of lighten().Use lighten() to make the color lighter by 30%. Then use rgba() with alpha 0.7 for 70% opacity.
Fill all three blanks to create a map of colors where keys are uppercase color names and values are colors darkened by 15%.
$colors: ("red": #ff0000, "green": #00ff00, "blue": #0000ff); $dark-colors: ([1]: darken([2], 15%) for [3] in $colors); .container { background-color: map-get($dark-colors, "RED"); }
Use map to iterate over the map. key is the color name, value is the color value. to-upper-case converts keys to uppercase.