Add color.whiteness() and color.blackness() functions (#1110)

See sass/sass#2834
See #1089
This commit is contained in:
Natalie Weizenbaum 2020-10-14 16:15:46 -07:00 committed by GitHub
parent a56750b71b
commit 7ba5128423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -1,5 +1,16 @@
## 1.28.0
* Add a [`color.hwb()`] function to `sass:color` that can express colors in [HWB] format.
[`color.hwb()`]: https://sass-lang.com/documentation/modules/color#hwb
[HWB]: https://en.wikipedia.org/wiki/HWB_color_model
* Add [`color.whiteness()`] and [`color.blackness()`] functions to `sass:color`
to get a color's [HWB] whiteness and blackness components.
[`color.whiteness()`]: https://sass-lang.com/documentation/modules/color#whiteness
[`color.blackness()`]: https://sass-lang.com/documentation/modules/color#blackness
### Dart API
* Add [HWB] support to the `SassColor` class, including a `SassColor.hwb()`

View File

@ -281,6 +281,18 @@ final module = BuiltInModule("color", functions: [
}
}),
_function(
"whiteness",
r"$color",
(arguments) =>
SassNumber(arguments.first.assertColor("color").whiteness, "%")),
_function(
"blackness",
r"$color",
(arguments) =>
SassNumber(arguments.first.assertColor("color").blackness, "%")),
// ### Opacity
_removedColorFunction("opacify", "alpha"),
_removedColorFunction("fade-in", "alpha"),