You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the correct name should be lightness or blackness on the color space docs. Something worth noting is that the deprecation also requires users to convert color space manually, as color.channel won't do that. An exmaple here:
@use"sass:color";
$color: #f5f7ff;
// $channel: Color #f5f7ff has no channel named lightness.@debug color.channel($color, 'lightness');
// works and return 98.0392156863%@debug color.channel(color.to-space($color, hsl), 'lightness');
So I believe at least the docs needs an update.
If the current behavior of color.channel is a bug, and sass team believes a channel name could be returned with any legacy color space by automatically converted to a correct space behind the sence, then only whiteness and blackness should be corrected in docs.
Otherwise, every deprecation about color.channel should be corrected, like color.red($color) must be replaced by color.channel(color.to-space($color, rgb), 'red'), unless the developer is sure that $color MUST be in rgb space
The text was updated successfully, but these errors were encountered:
Mister-Hope
changed the title
color.channel can not auto convert between spaces
color.channel can not auto convert between spaces and wrong docs about it
Sep 18, 2024
Returns the value of $channel in $space, which defaults to $color’s space.
When you call color.channel(#f5f7ff, "whiteness"), the $space argument defaults to rgb because that's the color space of hex colors. If you explicitly pass $space: hwb, it will work regardless of the space of the input color (example).
It is probably worth adding the explicit $space parameter to the deprecation.
Reproduction: https://sass-lang.com/playground/#eJwzNHAoLU5VUCpOLC62Ss7PyS9SsubiUgGzrBSU00zTzNPSgCIOKalJpekKYHG95IzEvLzUHA2IMh0F9fKMzJLUvNTiYnVNawAzfhqY
I don't think this is the expected behavior.
The docs says:
However, the correct name should be lightness or blackness on the color space docs. Something worth noting is that the deprecation also requires users to convert color space manually, as
color.channel
won't do that. An exmaple here:So I believe at least the docs needs an update.
If the current behavior of
color.channel
is a bug, and sass team believes a channel name could be returned with any legacy color space by automatically converted to a correct space behind the sence, then only whiteness and blackness should be corrected in docs.Otherwise, every deprecation about
color.channel
should be corrected, likecolor.red($color)
must be replaced bycolor.channel(color.to-space($color, rgb), 'red')
, unless the developer is sure that$color
MUST be in rgb spaceThe text was updated successfully, but these errors were encountered: