Sass fade-in()

Beginner
12 min read
Updated: Nov 2026
5 examples
Compiled CSS

Definition and Usage

fade-in($color, $amount) increases a legacy color’s alpha by a fixed amount between 0 and 1 (inclusive) and returns a new color. It is a global built-in — there is no color.fade-in(). Official docs list it as an alias of opacify().

Deprecated.

Official Sass docs list fade-in() / opacify() under Deprecated Functions. Fixed addition often overshoots (alpha 0.7 + 0.3 becomes fully opaque). Prefer color.scale($color, $alpha: $percent) for relative opacity, or color.adjust($color, $alpha: $amount) to keep the old math.

Official idea.

fade-in(rgba(#e1d7d2, 0.5), 0.4) → rgba(225, 215, 210, 0.9). But fade-in(rgba(#036, 0.7), 0.3) → solid #036, while color.scale(rgba(#036, 0.7), $alpha: 30%) → rgba(0, 51, 102, 0.79).

Legacy colors only.

$color must be in rgb, hsl, or hwb. Opposite deprecated twin: fade-out() / transparentize().

Syntax

SCSS
// Deprecated globals (aliases)
fade-in($color, $amount);
opacify($color, $amount);

// Preferred — relative opacity
@use "sass:color";
color.scale($color, $alpha: $percent);

// Same fixed math as fade-in / opacify
color.adjust($color, $alpha: $amount);

Pattern: recognize old fade-in / opacify → choose scale for design intent or adjust for pixel-matching migrations.

Migrate to scale / adjust

Official migration paths:

Old / intentPrefer
fade-in($c, $amount) — relative “% more opaque”color.scale($c, $alpha: $percent)
Keep exact old mathcolor.adjust($c, $alpha: $amount)
opacify($c, $amount)Same migrations as fade-in
No module formThere is no color.fade-in()

Quick mental model: fade-in = fixed alpha add, scale = percent of remaining room, adjust = same fixed math, modern API.

SCSS Examples

Examples use deprecated global fade-in() / opacify() plus modern scale / adjust. Open View Compiled CSS for verified output (matches official Sass docs samples).

Example 1 — Alpha 0.5 → 0.9 (Official Docs)

A soft taupe wash becomes more solid by a fixed 0.4 alpha.

SCSS
@debug fade-in(rgba(#e1d7d2, 0.5), 0.4); // rgba(225, 215, 210, 0.9)

.card {
  background: rgba(#e1d7d2, 0.5);
  &.strong {
    background: fade-in(rgba(#e1d7d2, 0.5), 0.4);
  }
}

How It Works

  1. Add 0.4 to alpha (0.5 → 0.9).
  2. Room below 1 means the wash still looks translucent.
  3. Strong state emits finished rgba().
  4. Risky when the color is already mostly opaque (see Example 3).

Example 2 — opacify() Alias (Official Docs)

Same API, different name: alpha 0.5 + 0.2 → 0.7.

SCSS
@debug opacify(rgba(#6b717f, 0.5), 0.2); // rgba(107, 113, 127, 0.7)

.overlay {
  --wash: #{rgba(#6b717f, 0.5)};
  --solidish: #{opacify(rgba(#6b717f, 0.5), 0.2)};
}

How It Works

  1. opacify and fade-in are interchangeable.
  2. Alpha 0.5 + 0.2 becomes 0.7.
  3. Custom properties store wash vs stronger fill.
  4. Migrate both names as the same deprecated step.

Example 3 — High Alpha + Amount → Solid (Official Docs)

Alpha 0.7 plus 0.3 clamps to fully opaque.

SCSS
// rgba(#036, 0.7) has alpha 0.7, so when fade-in() adds 0.3 it returns a fully
// opaque color.
@debug fade-in(rgba(#036, 0.7), 0.3); // #036

.deep {
  color: fade-in(rgba(#036, 0.7), 0.3);
}

How It Works

  1. Alpha starts at 0.7.
  2. Add 0.3 → hits 1.0 → fully opaque.
  3. You asked for “a bit more opaque” and wiped the transparency out.
  4. Dart Sass may emit #003366 (same navy as shorthand #036).

Example 4 — Prefer color.scale() (Official Docs)

Same seed color, relative 30% opacity keeps a usable translucent navy.

SCSS
@use "sass:color";

// scale() instead makes it 30% more opaque than it was originally.
@debug color.scale(rgba(#036, 0.7), $alpha: 30%); // rgba(0, 51, 102, 0.79)

.deep {
  --fade-in: #{fade-in(rgba(#036, 0.7), 0.3)};
  --scale: #{color.scale(rgba(#036, 0.7), $alpha: 30%)};
}

How It Works

  1. Side-by-side shows the trap vs the fix.
  2. fade-in collapses to solid.
  3. scale keeps alpha near 0.79.
  4. Prefer scale in new SCSS for overlays and hover fills.

Example 5 — Preserve Old Math with color.adjust()

Match fade-in(rgba(#6b717f, 0.5), 0.2) exactly when migrating.

SCSS
@use "sass:color";

.tokens {
  --legacy: #{fade-in(rgba(#6b717f, 0.5), 0.2)};
  --adjust: #{color.adjust(rgba(#6b717f, 0.5), $alpha: 0.2)};
  --brand: #{fade-in(rgba(#336699, 0.2), 0.3)};
}

How It Works

  1. --legacy and --adjust match — safe visual swap.
  2. Use $alpha: +$amount (add opacity), not a negative.
  3. Still consider scale when redesigning overlay tokens.
  4. Module form documents where the helper comes from.

Edge Cases & Pitfalls

Most fade-in bugs are fixed math on already-opaque washes, or expecting a module API.

opaque

Overshoot → solid

If alpha plus $amount hits 1, you get a fully opaque color. Use color.scale instead.

module

No color.fade-in()

After @use "sass:color", call scale or adjust — not color.fade-in.

units

Amount is 0–1, not %

fade-in($c, 0.3) adds 0.3 alpha. Relative “30% more opaque” is scale(..., $alpha: 30%).

alias

Same as opacify

Treat fade-in and opacify as one deprecated API when searching and migrating.

Sass Support

Global fade-in / opacify still compile, but new work should use the module writers.

FeatureStatus
Global fade-in() / opacify()Deprecated — still available for legacy SCSS
color.scale(..., $alpha: …)Preferred relative opacity
color.adjust(..., $alpha: …)Same fixed math as fade-in
color.fade-in()Does not exist

Compile with the Dart Sass CLI.

Key Takeaways

  • Deprecated: fixed alpha addition on legacy colors (alias of opacify).
  • Prefer color.scale for “percent more opaque.”
  • Use color.adjust(..., $alpha: $amount) when you must match old pixels.
  • No module form — there is no color.fade-in().

One line: learn fade-in to read legacy overlays; write scale (or adjust) in new code.

Migrate Notes

Conceptual flow:

flow.txt
1. Find fade-in($color, $amount) or opacify($color, $amount)
2. Want "% more opaque"? → color.scale($color, $alpha: $percent)
3. Need same pixels? → color.adjust($color, $alpha: $amount)
4. @use "sass:color"
5. Delete the global fade-in() / opacify() call

Frequently Asked Questions

fade-in($color, $amount) increases a legacy color’s alpha by $amount (0–1). Example: fade-in(rgba(#e1d7d2, 0.5), 0.4) is rgba(225, 215, 210, 0.9); fade-in(rgba(#036, 0.7), 0.3) is fully opaque #036.
Yes. Official Sass docs list fade-in($color, $amount) and opacify($color, $amount) as aliases that return the same color.
Yes. Official Sass docs list it under Deprecated Functions and omit it from the sass:color module. Prefer color.scale() for relative opacity changes, or color.adjust($color, $alpha: $amount) to keep the old math.
Because fade-in() is usually not the best way to make a color more opaque, it is not included in the new module system. Use color.scale or color.adjust instead.
fade-in adds a fixed alpha amount (0.7 + 0.3 becomes fully opaque). color.scale($c, $alpha: 30%) makes the color 30% more opaque than it was, which is usually what designers want.
For the same fixed addition: color.adjust($color, $alpha: $amount). For better relative opacity: color.scale($color, $alpha: $percent). opacify() migrates the same way.

Next: Sass color.red()

Read the RGB red channel — prefer color.channel in new code.

color.red() →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful