0
0
SASSmarkup~30 mins

Saturate and desaturate in SASS - Mini Project: Build & Apply

Choose your learning style9 modes available
Saturate and Desaturate Colors with Sass
📖 Scenario: You are designing a simple webpage with colored boxes. You want to learn how to make colors more vivid or more muted using Sass color functions.
🎯 Goal: Create a Sass stylesheet that defines a base color and then uses saturate() and desaturate() functions to create two new colors. Apply these colors to three boxes in HTML to see the effect visually.
📋 What You'll Learn
Define a base color variable in Sass
Create a saturated color by increasing saturation of the base color
Create a desaturated color by decreasing saturation of the base color
Use semantic HTML with three section elements for the colored boxes
Apply the colors to the boxes using CSS classes
Include responsive design so boxes stack on small screens
Use accessible color contrast for text inside boxes
💡 Why This Matters
🌍 Real World
Designers and developers often need to adjust colors dynamically to create visually appealing and accessible websites. Using Sass functions like saturate and desaturate helps maintain consistent color schemes.
💼 Career
Understanding Sass color functions and responsive design is essential for front-end developers and UI designers to build modern, accessible, and maintainable web interfaces.
Progress0 / 4 steps
1
Set up base color variable in Sass
Create a Sass variable called $base-color and set it to #3498db (a blue shade).
SASS
Need a hint?
Use the syntax $variable-name: value; to create a Sass variable.
2
Create saturated and desaturated color variables
Create two new Sass variables: $more-saturated by saturating $base-color by 30%, and $less-saturated by desaturating $base-color by 30%. Use the saturate() and desaturate() functions.
SASS
Need a hint?
Use saturate($color, 30%) and desaturate($color, 30%) to adjust saturation.
3
Write CSS classes to apply the colors
Write three CSS classes: .box-base with background $base-color, .box-saturated with background $more-saturated, and .box-desaturated with background $less-saturated. Set text color to white and add padding and margin for visibility.
SASS
Need a hint?
Use background-color: $variable; inside each class and add color: white; for text.
4
Add HTML structure and responsive layout
Write HTML with three section elements with classes box-base, box-saturated, and box-desaturated. Each box should have text describing the color. Add a container main with a CSS flex layout that stacks boxes vertically on narrow screens and horizontally on wider screens.
SASS
Need a hint?
Use semantic section tags with the correct classes and a main container with flexbox and a media query for responsiveness.