0
0
SASSmarkup~3 mins

Why Saturate and desaturate in SASS? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

Discover how a simple function can transform dull colors into vibrant designs effortlessly!

The Scenario

Imagine you are designing a website and want to make a button color brighter or duller by changing its color intensity manually.

The Problem

If you try to adjust colors by guessing hex codes or RGB values, it takes a lot of trial and error, and you might not get consistent results across your site.

The Solution

Sass's saturate() and desaturate() functions let you easily increase or decrease the color's intensity with simple numbers, making your colors pop or soften consistently.

Before vs After
Before
$button-color: #336699; // then guess a brighter color like #4d80b2
After
$button-color: #336699;
$brighter: saturate($button-color, 20%);
$duller: desaturate($button-color, 20%);
What It Enables

You can quickly create harmonious color variations that improve your design's look and feel without guesswork.

Real Life Example

When making a hover effect on a button, you can use saturate() to make the button color more vivid on hover, giving clear visual feedback to users.

Key Takeaways

Manual color tweaking is slow and inconsistent.

saturate() and desaturate() adjust color intensity easily.

They help create consistent, attractive color variations in your design.