color.blackness($color) returns the HWB blackness of a legacy color as a percentage between 0% and 100% (Dart Sass 1.28+). Global alias: blackness($color).
In the HWB (Hue–Whiteness–Blackness) model, blackness is how much black is mixed into the pure hue. Official docs mark the helper deprecated — prefer color.channel($color, "blackness") on Dart Sass 1.79+.
No longer recommended.
Because color.blackness() is redundant with color.channel(), migrate readers to the channel API in new code.
Official samples.
color.blackness(#e1d7d2) ≈ 11.76%. white → 0%. black → 100%.
Pair with whiteness.
Read both HWB mix channels with color.whiteness() (also deprecated; same color.channel migration).
Reads HWB blackness as a percentage from 0% to 100%.
Deprecated in favor of color.channel($c, "blackness").
Pair with whiteness to understand HWB mix channels.
Dart Sass 1.28+ for blackness; 1.79+ for channel.
One line: use color.blackness to understand old HWB reads — write new ones with color.channel.
Migrate
Migrate Notes
Practical checklist:
migrate.txt
1. Find color.blackness($c) in legacy SCSS
2. Confirm Dart Sass 1.28+ (reader) or 1.79+ (channel)
3. Replace with color.channel($c, "blackness")
4. Add $space: hwb when reading non-legacy colors
5. Use adjust/change when you need to write blackness
Frequently Asked Questions
color.blackness($color) returns the HWB blackness of a legacy color as a percentage between 0% and 100%. Example: color.blackness(black) is 100%; color.blackness(white) 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, "blackness").
In the HWB (Hue-Whiteness-Blackness) model, blackness is how much black is mixed into the pure hue. Higher blackness means a darker, inkier 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, "blackness", $space: hwb) on Dart Sass 1.79+.
Replace color.blackness($color) with color.channel($color, "blackness") after @use "sass:color" on Dart Sass 1.79+. Keep color.blackness on older 1.28–1.78 compilers until you upgrade.