color.ie-hex-str() belongs to the built-in sass:color module. It formats a color as an unquoted #AARRGGBB string for legacy Internet Explorer -ms-filter values—at compile time. This page covers the alpha-first layout, how opacity maps into AA, when (not) to use it, and five compiled examples.
01
Concept
#AARRGGBB string
02
Module
@use "sass:color"
03
Alpha
First two hex digits
04
Target
IE -ms-filter
05
Modern
Prefer CSS gradients
06
Practice
5 examples
Concept
What Is color.ie-hex-str()?
ie-hex-str means “turn this Sass color into the weird hex string old IE filters expected.” Official docs: it returns an unquoted string in #AARRGGBB form for Internet Explorer’s -ms-filter property.
Normal CSS hex is often #RRGGBB (or #RRGGBBAA). IE filter strings put alpha first: #AARRGGBB. Opaque colors start with FF.
Foundation
📝 Syntax
Load the color module, then pass one color:
styles.scss
@use "sass:color";
color.ie-hex-str($color)
// Global alias:
// ie-hex-str($color)
Parameters
Parameter
Type
Description
$color
Color
Any Sass color to encode (required).
Return value
Type
Meaning
Unquoted string
A #AARRGGBB value suitable for IE filter color arguments—not a Sass color type.
Modules
📦 Loading sass:color
Prefer the module API. Official docs also document the global name ie-hex-str() for older stylesheets.
styles.scss
// Recommended — namespaced
@use "sass:color";
$ie: color.ie-hex-str(#b37399);
// Optional — bring members into the current namespace
@use "sass:color" as *;
$ie: ie-hex-str(#b37399);
// Optional — custom namespace
@use "sass:color" as c;
$ie: c.ie-hex-str(#b37399);
// Legacy global name
$ie: ie-hex-str(#b37399);
⚠️
Put @use first
Keep @use "sass:color"; near the top of the file. Built-in modules need Dart Sass (about 1.23+).
Format
🎨 Reading #AARRGGBB
Break the string into four byte pairs. Alpha comes first—that is the whole point of this helper.
Official docs note: if $color is not already in the rgb space, Sass converts it to rgb and gamut-maps if necessary. The gamut-mapping algorithm may change in future Sass versions; docs currently mention local-minde.
styles.scss
@use "sass:color";
@debug color.ie-hex-str(#b37399); // #FFB37399
@debug color.ie-hex-str(rgba(242, 236, 228, 0.6)); // #99F2ECE4
// Modern color spaces also convert to rgb for the IE string (newer Dart Sass):
// @debug color.ie-hex-str(oklch(70% 10% 120deg)); // #FF9BA287
Prefer
🎯 Modern CSS Instead
For new UI, skip IE filter strings. Use standard CSS that every current browser understands.
This is about Sass compilers, not modern browser color APIs. The string is meant for obsolete IE filter CSS, not for today’s color properties.
Feature
Dart Sass
Notes
@use "sass:color" / color.ie-hex-str
1.23+
Preferred module API
Global ie-hex-str()
Long-standing
Prefer module form in new SCSS
Non-RGB inputs
Converts to rgb
May gamut-map; algorithm can evolve
LibSass / Ruby Sass
No modern module API
May expose global ie-hex-str(); prefer Dart Sass
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import color
@use "sass:color";
Opaque hex → IE string
color.ie-hex-str(#b37399)
Transparent color
color.ie-hex-str(rgba(242, 236, 228, 0.6))
Shorthand hex
color.ie-hex-str(#abc) → #FFAABBCC
Legacy global
ie-hex-str(#b37399)
Modern gradient (preferred)
background: linear-gradient(...);
Hands-On
Examples Gallery
Each example uses @use "sass:color". These patterns are for legacy IE maintenance only. Open View Compiled CSS to see the #AARRGGBB strings.
📚 Getting Started
Official-style opaque and transparent encodings.
Example 1 — Official Opaque Hex
Encode a solid color as #AARRGGBB (official docs sample).
styles.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 FF, then the RGB bytes. The return value is a string, so interpolation with #{} is common when embedding it.
Example 2 — Transparent Colors
Alpha becomes the leading byte pair (official 0.6 sample plus more).
Module and global calls match. Prefer color.ie-hex-str() so readers see the helper comes from sass:color.
Applications
🚀 Real-World Use Cases
Legacy IE gradients — progid:DXImageTransform.Microsoft.gradient color stops.
Old -ms-filter sheets — maintain color args without hand-writing #AARRGGBB.
Migration audits — find IE filter strings while replacing them with modern CSS.
Brand token bridges — keep one Sass color, emit IE strings only where still required.
Teaching alpha-first hex — show why IE strings look “backwards” vs #RRGGBBAA.
💡
Not a use case
Do not use ie-hex-str for normal color, background, borders, or CSS variables meant for modern browsers.
🧠 How Compilation Works
1
Write SCSS
Call color.ie-hex-str($color) after @use.
Source
2
Convert to rgb
Non-RGB colors convert (and may gamut-map).
RGB
3
Build #AARRGGBB
Alpha byte first, then R, G, and B.
Encode
4
✓
Unquoted string ships
CSS gets a string—not a modern color function call.
Watch Out
⚠️ Common Pitfalls
Using it as a normal color — #AARRGGBB is for IE filters, not modern color: values.
Confusing with #RRGGBBAA — alpha is first here, not last.
Building new features on -ms-filter — that API is obsolete; use standard CSS.
Forgetting it returns a string — you often need #{} interpolation inside larger declarations.
Expecting browsers to “understand” IE strings — modern engines ignore proprietary filter progids.
Pro Tips
💡 Best Practices
✅ Do
Use color.ie-hex-str() only in legacy IE maintenance
Keep brand colors as normal Sass colors; derive IE strings when required
Migrate filters to linear-gradient() and standard CSS
Prefer @use "sass:color" on Dart Sass
Document why any remaining -ms-filter block still exists
❌ Don’t
Introduce ie-hex-str into new design systems
Paste IE strings into modern color properties
Assume #FFRRGGBB equals CSS #RRGGBBFF
Rely on LibSass for the module API
Teach this as the default way to “export hex from Sass”
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about color.ie-hex-str()
Alpha-first IE strings—legacy only, not modern CSS colors.
5
Core concepts
📝01
Call
ie-hex-str($color)
API
📦02
Returns
unquoted string
String
🎨03
Format
#AARRGGBB
Alpha first
⚡04
For
IE -ms-filter
Legacy
✓05
Prefer
modern CSS
Today
❓ 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.
Did you know?
Official Sass docs still document color.ie-hex-str() because old codebases needed #AARRGGBB for IE filters—and they note that non-RGB colors are converted to rgb with possible gamut mapping. That conversion exists so the IE string can always be built, not because modern CSS needs this format.
color.ie-hex-str() encodes a color as an unquoted #AARRGGBB string for legacy Internet Explorer filters. Learn it so you can read old SCSS—then prefer modern CSS gradients and colors for anything new.