color.alpha($color) returns the alpha channel of a legacy color as a number between 0 and 1. Aliases: global alpha($color) and opacity($color) / color.opacity($color).
Deprecated in favor of color.channel($c, "alpha").
Aliases:opacity() / color.opacity() for color args.
IE alpha(opacity=) returns a string, not a number.
One line: use color.alpha to understand old code — write new opacity reads with color.channel.
Migrate
Migrate Notes
Practical checklist:
migrate.txt
1. Find color.alpha($c) / opacity($c) in legacy SCSS
2. Require Dart Sass 1.79+ for color.channel
3. Replace with color.channel($c, "alpha")
4. Leave alpha(opacity=…) alone only if IE filters remain
5. Use adjust/change/scale when you need to write alpha
Frequently Asked Questions
color.alpha($color) returns the alpha channel as a number between 0 and 1. Example: color.alpha(#e1d7d2) is 1; color.opacity(rgb(210, 225, 221, 0.4)) is 0.4.
Yes. Official Sass docs list it under Deprecated Functions and say it is no longer recommended because it is redundant with color.channel($color, "alpha").
For a color argument they are aliases: both return 0–1. opacity($color) is the same idea as color.alpha($color). Prefer the modern color.channel form in new code.
That is a special Internet Explorer filter syntax. Sass returns the unquoted string alpha(opacity=20) instead of reading a color’s alpha.
Official docs require a legacy color space (rgb, hsl, or hwb). Convert first with color.to-space(), or read alpha with color.channel on Dart Sass 1.79+.
Replace color.alpha($color) with color.channel($color, "alpha") after @use "sass:color" on Dart Sass 1.79+. Keep color.alpha only when maintaining older compilers or legacy SCSS.