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
Now that >95% of browsers support hsl() (source) and hsla() (source), we can bring them into the set of color formats that we preserve in expanded mode for readability purposes.
This will require some amount of refactoring of how we handle "original colors". Currently we store the originalSpan and use its text to determine the actual format of the color, but this won't work for color functions where the source span may contain variable references and so on. While we could create a synthetic span, it's probably cleaner to change the "original representation" to an enum of different possible formats (longHex, shortHex, name (which may need a string attached since some colors have multiple names), rgb, hsl) and use those to recreate the appropriate serialization format.
Note that we should serialize these colors using the comma-separated function formats even if the author used a space-separated format since that's not yet widely supported. Similarly, we should serialize colors with non-1 alpha channels using rgba() and hsla() even though that's no longer necessary per spec.
Note: This issue does not cover emitting hsl() in the compressed output. We never intend to support that for the reasons outlined in sass/sass#469, and attempts to argue that case in this issue will be marked as spam.
The text was updated successfully, but these errors were encountered:
As original Author of #469, i'm glad that you try to plan to preserve the color format in expanded mode.
If I understood you correctly, you try to preserve hsl in non-compressed output, but you will omit them in compressed output? If so, this would be totally ok. In this case, it would be possible to use another minifier to compress the css, and preserving the hsl.
Now that >95% of browsers support
hsl()
(source) andhsla()
(source), we can bring them into the set of color formats that we preserve in expanded mode for readability purposes.This will require some amount of refactoring of how we handle "original colors". Currently we store the
originalSpan
and use its text to determine the actual format of the color, but this won't work for color functions where the source span may contain variable references and so on. While we could create a synthetic span, it's probably cleaner to change the "original representation" to an enum of different possible formats (longHex
,shortHex
,name
(which may need a string attached since some colors have multiple names),rgb
,hsl
) and use those to recreate the appropriate serialization format.Note that we should serialize these colors using the comma-separated function formats even if the author used a space-separated format since that's not yet widely supported. Similarly, we should serialize colors with non-
1
alpha channels usingrgba()
andhsla()
even though that's no longer necessary per spec.Note: This issue does not cover emitting
hsl()
in the compressed output. We never intend to support that for the reasons outlined in sass/sass#469, and attempts to argue that case in this issue will be marked as spam.The text was updated successfully, but these errors were encountered: