color.ie-hex-str() returns an unquoted#AARRGGBB string — the format Internet Explorer expected in -ms-filter / progid:DXImageTransform.Microsoft.gradient. Load it with @use "sass:color". The global alias is ie-hex-str().
Alpha comes first (not #RRGGBBAA). Opaque colors start with FF. If $color is not already RGB, Sass converts to RGB and gamut-maps if needed (currently local-minde).
Legacy maintenance only.
Do not use this helper for modern CSS color, background, or border-color. Prefer standard hex / rgba() / linear-gradient().
Each example uses @use "sass:color" for legacy IE maintenance only. Open View Compiled CSS to see what Dart Sass emits.
Example 1 — Official Opaque Hex
Encode a solid color as #AARRGGBB (official docs sample).
SCSS
@use "sass:color";
@debug color.ie-hex-str(#b37399); // #FFB37399
.legacy {
/* Not a modern CSS color property — string for IE filter tooling */
--ie-start: #{color.ie-hex-str(#b37399)};
}
Compiled CSS
.legacy {
--ie-start: #FFB37399;
}
How It Works
Opaque colors get alpha byte FF.
RGB bytes follow — B37399.
Return value is a string, so #{} interpolates it.
Matches the official sample #FFB37399.
Example 2 — Transparent Colors
Alpha becomes the leading byte pair (official 0.6 sample plus more).
Skip in new CSS — use hex / rgba / linear-gradient instead.
One line:color.ie-hex-str is a maintenance bridge for old IE filters — not a modern color format.
Compile
Compile Notes
Conceptual flow:
flow.txt
1. @use "sass:color"
2. Resolve $color (convert to RGB if needed)
3. Encode alpha as AA, then RR GG BB
4. Return an unquoted #AARRGGBB string
5. Interpolate into legacy -ms-filter strings only
Frequently Asked Questions
color.ie-hex-str($color) returns an unquoted #AARRGGBB string for Internet Explorer’s -ms-filter property. Example: color.ie-hex-str(#b37399) is #FFB37399.
IE’s filter format is #AARRGGBB, not the more common #RRGGBBAA. Opaque colors start with FF; rgba(242, 236, 228, 0.6) becomes #99F2ECE4.
No. It exists for legacy IE -ms-filter strings. Modern CSS should use standard gradients, colors, and filters instead.
Add @use "sass:color"; then call color.ie-hex-str($brand). Prefer the module form. The global alias is ie-hex-str().
Yes. Official docs say if $color is not already in rgb, Sass converts it to rgb and gamut-maps if needed before building the IE string.
The module form needs Dart Sass with @use (about 1.23+). LibSass/Ruby Sass may expose a global ie-hex-str() but lack the modern module API.