color.whiteness($color) returns the HWB whiteness of a legacy color as a number between 0% and 100%. Global alias: whiteness($color). Available since Dart Sass 1.28+.
Because color.whiteness() is redundant with color.channel(), migrate readers to the channel API in new code. Pass $space: hwb for hex/rgb colors — rgb has no whiteness channel of its own.
Official samples.
color.whiteness(#e1d7d2) → 82.3529411765%. white → 100%. black → 0%.
Legacy colors only.
$color must be in a legacy space (rgb, hsl, or hwb). For modern spaces, use color.channel(..., $space: hwb).
Prefer color.channel with $space: hwb on Dart Sass 1.79+.
Pair with blackness when describing an HWB mix.
Not HSL lightness — different model, different channel.
One line: treat color.whiteness as legacy — new reads should use color.channel($c, "whiteness", $space: hwb).
Practice
Migrate Notes
Practical checklist:
checklist.txt
1. Find color.whiteness() / whiteness()
2. Replace with color.channel($c, "whiteness", $space: hwb)
3. Keep Dart Sass 1.28+ only if you cannot upgrade yet
4. Pair with blackness when auditing HWB mixes
5. Use scale / adjust (not the reader) to change whiteness
Frequently Asked Questions
color.whiteness($color) returns the HWB whiteness of a legacy color as a number between 0% and 100%. Example: color.whiteness(#e1d7d2) is about 82.35%; color.whiteness(white) is 100%; color.whiteness(black) is 0%.
Yes. Official Sass docs list it under Deprecated Functions and say it is no longer recommended because it is redundant with color.channel($color, "whiteness", $space: hwb).
In the HWB (Hue-Whiteness-Blackness) model, whiteness is how much white is mixed into the pure hue. Higher whiteness means a lighter, chalkier color.
Official docs: Dart Sass since 1.28.0. LibSass and Ruby Sass are not supported for this helper.
Official docs require a legacy color space (rgb, hsl, or hwb). Convert first, or use color.channel($color, "whiteness", $space: hwb) on Dart Sass 1.79+.
Replace color.whiteness($color) with color.channel($color, "whiteness", $space: hwb) after @use "sass:color" on Dart Sass 1.79+. Hex/rgb colors need $space: hwb because rgb has no whiteness channel.