Sass
CSS preprocessor

Sass opacify() Function

Beginner
⏱️ 12 min read
📚 Updated: Jul 2026
🎯 5 Examples
Deprecated
Global · Dart Sass

What You’ll Learn

opacify() is a global Sass helper documented in the sass:color module page (Deprecated Functions). It makes a legacy color more opaque by increasing alpha by $amount at compile time. This page covers the fixed-amount trap, the fade-in alias, why the module system skipped it, how it differs from color.scale(), migration to color.adjust(), and five compiled examples.

01

Concept

Add alpha 0–1

02

Status

Deprecated global

03

Alias

fade-in()

04

Prefer

color.scale()

05

Same math

color.adjust()

06

Practice

5 examples

What Is opacify()?

Opacify means “make this color less see-through.” Official docs: it increases the alpha channel of $color by $amount (01). RGB (or HSL) stays the same; only transparency moves toward solid by a fixed chunk.

  • opacify(rgba(#6b717f, 0.5), 0.2)rgba(107, 113, 127, 0.7)
  • fade-in(rgba(#e1d7d2, 0.5), 0.4)rgba(225, 215, 210, 0.9)
  • opacify(rgba(#036, 0.7), 0.3)#036 (fully opaque)
💡
Beginner tip

Fixed addition is like pouring the same cup of paint into every glass. A glass that is already almost full (alpha 0.7) overflows to solid. Relative scaling is like “fill 30% of the remaining empty space”—that is color.scale.

📝 Syntax

Call the global function (or its alias) with a legacy color and an alpha step:

styles.scss
// Deprecated globals (legacy colors only) — aliases
opacify($color, $amount)
fade-in($color, $amount)

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

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

Parameters

ParameterTypeDescription
$colorColorMust be in a legacy color space (rgb, hsl, or hwb).
$amountNumberHow much to add to alpha, between 0 and 1 (inclusive).

Return value

TypeMeaning
ColorA more opaque color (may clamp to fully opaque when alpha hits 1).

📦 Why There Is No color.opacify()

Official docs: because opacify() is usually not the best way to make a color more opaque, it is not included in the new module system. You will not find color.opacify or color.fade-in after @use "sass:color".

styles.scss
// Old (deprecated globals — same result)
$fill: opacify(rgba(#6b717f, 0.5), 0.2);
$fill: fade-in(rgba(#6b717f, 0.5), 0.2);

@use "sass:color";

// Same fixed addition as opacify
$fill: color.adjust(rgba(#6b717f, 0.5), $alpha: 0.2);

// Usually better — 20% more opaque relative to the original
$fill: color.scale(rgba(#6b717f, 0.5), $alpha: 20%);
⚠️
Migration note

Matching old opacify math means adding alpha with color.adjust($c, $alpha: $amount). Prefer color.scale($c, $alpha: $percent) when you redesign overlays and hover fills.

📋 opacify vs color.scale vs color.adjust

Official docs call out this trap with rgba(#036, 0.7) (already mostly opaque):

CallResultWhy
opacify(rgba(#036, 0.7), 0.3)#036 (opaque)Adds 0.3 alpha to 0.7 → clamps to 1
color.scale(rgba(#036, 0.7), $alpha: 30%)rgba(0, 51, 102, 0.79)Moves 30% of the way toward full opacity
color.adjust(..., $alpha: 0.3)Same fixed math as opacifyUse only when you need identical legacy behavior

🛠 Compatibility

This is about Sass compilers, not browsers. Compiled CSS receives a finished color—no opacify() call remains at runtime.

FeatureDart SassNotes
Global opacify() / fade-in()Yes (deprecated)Legacy colors only; omitted from sass:color
color.scale($alpha: …)Yes (module)Preferred relative opacity change
color.adjust($alpha: …)Yes (module)Same fixed math as opacify
LibSass / Ruby SassGlobals likelyLack modern module APIs

⚡ Quick Reference

GoalCode
Opacify 0.2 (legacy)opacify(rgba(#6b717f, 0.5), 0.2)rgba(107, 113, 127, 0.7)
fade-in aliasfade-in(rgba(#e1d7d2, 0.5), 0.4)rgba(225, 215, 210, 0.9)
Overshoot trapopacify(rgba(#036, 0.7), 0.3)#036
Relative opacitycolor.scale(rgba(#036, 0.7), $alpha: 30%)rgba(0, 51, 102, 0.79)
Same math as opacifycolor.adjust($c, $alpha: 0.2)
Read alpha insteadcolor.opacity($c) / color.channel($c, "alpha")

Examples Gallery

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

📚 Getting Started

Official docs samples for everyday opacify amounts.

Example 1 — Alpha 0.5 → 0.7 (Official Docs)

A semi-transparent slate becomes more solid by a fixed 0.2 alpha.

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

.overlay {
  background: rgba(#6b717f, 0.5);
  &.strong {
    background: opacify(rgba(#6b717f, 0.5), 0.2);
  }
}

How It Works

Sass adds 0.2 to alpha and emits a finished rgba(). Fine when there is room below 1—risky when the color is already mostly opaque.

Example 2 — fade-in() Alias (Official Docs)

Same API, different name: alpha 0.5 + 0.4 → 0.9.

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

.card {
  --wash: #{rgba(#e1d7d2, 0.5)};
  --solidish: #{fade-in(rgba(#e1d7d2, 0.5), 0.4)};
}

How It Works

fade-in and opacify are interchangeable. When you migrate, treat both names as the same deprecated step.

📈 Practical Patterns

The opaque trap, preferred scale, and adjust migration.

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

Alpha 0.7 plus 0.3 clamps to fully opaque.

styles.scss
// rgba(#036, 0.7) has alpha 0.7, so when opacify() adds 0.3 it returns a fully
// opaque color.
@debug opacify(rgba(#036, 0.7), 0.3); // #036

.deep {
  color: opacify(rgba(#036, 0.7), 0.3);
}

How It Works

This is the classic reason official docs discourage opacify. You asked for “a bit more opaque,” but fixed math wiped the transparency out. (Dart Sass may emit #003366, the same navy as shorthand #036.)

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

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

styles.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 {
  --opacify: #{opacify(rgba(#036, 0.7), 0.3)};
  --scale: #{color.scale(rgba(#036, 0.7), $alpha: 30%)};
}

How It Works

Side-by-side: opacify collapses to solid; scale keeps alpha near 0.79. Prefer scale in new SCSS.

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

Match opacify(rgba(#6b717f, 0.5), 0.2) exactly when migrating.

styles.scss
@use "sass:color";

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

How It Works

--legacy and --adjust match, so you can swap calls without visual diffs. Still consider scale when you redesign overlay tokens.

🚀 Real-World Use Cases

  • Reading legacy SCSS — recognize opacify() / fade-in() in older overlays.
  • Safe migrations — swap to color.adjust for identical output, or scale for better UX.
  • Teaching alpha — show fixed alpha steps vs relative scaling.
  • Audit traps — find opacify on already-opaque washes that snap to solid.
  • Pairing with transparentize — both globals are deprecated twins; migrate together.

🧠 How Compilation Works

1

Write SCSS

Call opacify($c, 0.2) or migrate to scale / adjust.

Source
2

Read alpha

Sass works on the alpha channel of legacy rgb/hsl/hwb colors.

Alpha
3

Add $amount

Alpha rises by a fixed step; may clamp at 1.

Opacify
4

Finished CSS color

Browsers see rgba() / hex—not a Sass function call.

⚠️ Common Pitfalls

  • Using it in new code — prefer color.scale (or adjust for same math).
  • Expecting color.opacify() — that name does not exist in sass:color.
  • High alpha + large amounts — easy to clamp to fully opaque unexpectedly.
  • Modern color spaces$color must be legacy for global opacify.
  • Confusing with color.opacity() — that helper reads alpha; opacify writes a new color.

💡 Best Practices

✅ Do

  • Use color.scale($c, $alpha: $n) for relative opacity
  • Use color.adjust(..., $alpha: $n) when matching old opacify
  • Audit already-opaque washes before applying large amounts
  • Migrate fade-in aliases in the same pass
  • Document overlay recipes with the modern API

❌ Don’t

  • Add new opacify() / fade-in() calls in greenfield projects
  • Look for color.opacify in the module
  • Pass modern oklch colors into global opacify
  • Expect the browser to re-run Sass at runtime
  • Assume fixed alpha steps feel “30% more opaque”

Key Takeaways

Knowledge Unlocked

Five things to remember about opacify()

Deprecated fixed alpha adder—prefer scale.

5
Core concepts
⚠️ 02

Status

Deprecated

Docs
🔄 03

Alias

fade-in()

Twin
📈 04

Prefer

color.scale()

Modern
05

Same math

color.adjust(…)

Migrate

❓ Frequently Asked Questions

opacify($color, $amount) increases a legacy color’s alpha by $amount (0–1). Example: opacify(rgba(#6b717f, 0.5), 0.2) is rgba(107, 113, 127, 0.7); opacify(rgba(#036, 0.7), 0.3) is fully opaque #036.
Yes. Official Sass docs list opacify($color, $amount) and fade-in($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 opacify() 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.
opacify 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). fade-in() migrates the same way.
Did you know?

Official Sass docs keep opacify() and fade-in() as the same helper for compatibility, but neither lives in sass:color. The modern story is color.scale for relative opacity and color.adjust when you must match the old fixed math exactly.

Conclusion

opacify() (alias fade-in()) is the classic global way to add alpha on legacy colors. Treat it as deprecated documentation: prefer color.scale($color, $alpha: $percent) for relative opacity, or color.adjust when you need identical old math.

Continue with fade-in(), color.scale(), or color.adjust().

Next: fade-in()

You learned deprecated opacify()—next, the same helper under its fade-in() alias.

fade-in() →

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.

5 people found this page helpful