csso icon indicating copy to clipboard operation
csso copied to clipboard

RGBA to HSLA

Open Snowball-V opened this issue 4 years ago • 1 comments

Paste here : https://css.github.io/csso/csso.html (version 4.0.3)

The following css :

 .test1 {    background: rgba(255,255,255,.9);  }

in Beautify’s mode you get something like :

 .test1 {    background: rgba(255,255,255,.9)  }

According to the last Chrome’s or Firefox’s code inspector, when we switch from RGBA to HSLA we see that rgba (255, 255, 255, .9) is converted to hsla (0deg, 0%, 100%, .9) in the inpector.

As combining HSLA + optional zero unit, don’t rgba(255,255,255,.9) (20 bytes) would be the same as hsla(0,0,100%,.9) (17 bytes) ?

Edit : removed flex question according to https://github.com/css/csso/issues/410

Snowball-V avatar Jun 09 '20 08:06 Snowball-V

There is currently no assumption in CSSO that hsl / hsla may be shorter than the rgb / rgba version. Such optimisation can be added. Personally I have no time for this now, but a PR is very welcome :)

lahmatiy avatar Jun 10 '20 19:06 lahmatiy