rgba() is a global Sass color constructor. It builds an RGB color with an alpha channel, or sets a new alpha on an existing color with rgba($color, $alpha).
Official Sass docs list it under Global Functions with rgb() as aliases in modern Dart Sass. It is not deprecated.
Global constructor — builds RGB + alpha at compile time.
Not deprecated — listed under Global Functions.
Alias ofrgb() in modern Dart Sass.
Use commas when channels are variables; slash is for literals.
One line: use rgba() to build translucent RGB tokens — prefer commas with variables, and color.change when you already live in sass:color.
Practice
Compile Notes
Practical checklist:
checklist.txt
1. Build translucent colors with rgba($r, $g, $b, $a)
2. Use Level 4 rgba(... / $alpha) for literals if you like that look
3. Prefer commas whenever variables are involved
4. Use rgba($color, $alpha) to keep channels and set opacity
5. Or color.change($color, $alpha: ...) inside @use "sass:color"
Frequently Asked Questions
rgba() builds an RGB color with an alpha channel, or replaces the alpha of an existing color. Example: rgba(95%, 92.5%, 89.5%, 0.2) is rgba(242, 236, 228, 0.2); rgba(#f2ece4, 50%) is rgba(242, 236, 228, 0.5).
In modern Dart Sass, yes—rgba() is an alias of rgb(). Both accept the same signatures, including rgba($color, $alpha) and the Level 4 slash form.
No. Official Sass docs list rgba()/rgb() under Global Functions as CSS-compatible color constructors. They are not in the Deprecated Functions list.
When you already use @use "sass:color" and only need to set alpha (or other channels) on a token. color.change(#6b717f, $alpha: 0.5) matches rgba(#6b717f, 0.5).
Yes in Dart Sass: rgba(#f2ece4, 50%) compiles to rgba(242, 236, 228, 0.5). LibSass does not support percent alpha.
If you pass special CSS functions like var() for a channel, Sass returns an unquoted string with the same signature so the browser can resolve it at runtime.