tinycss2 icon indicating copy to clipboard operation
tinycss2 copied to clipboard

support CSS Color Level 4

Open ax-sc opened this issue 3 years ago • 0 comments

Hi, thank you for your work on tinycss2 and WeasyPrint. As i would be very happy to see CMYK support in the future i took a closer look at the different color specifications and their implementation in WeasyPrint.

Coming from https://github.com/Kozea/WeasyPrint/issues/1630 and https://github.com/Kozea/tinycss2/issues/47 i started to work on the support of the CSS Color Level 4 specification.

The implementation is currently limited to:

  • parse_color() accepts now space-seperated arguments with an optional slash-seperated opacity
  • added definition of rebeccapurple
  • percentages are accepted for all opacity arguments
  • added hwb() function
  • hsla()/rgba() are aliases to hsl()/rgb()

Adding more tests to cover the changes and the level 4 spec would require changes to SimonSapin/css-parsing-tests. I did not start to prepare them yet, but i can open another PR there if this is the way you would like to implement the tests.

I will take a look at some of the other changes listed here and try to implement them as well (e.g. syntactic changes 1 and 2) but i wanted to check-in early to get your feedback before spending more time on this. Let me know what you think and if i should revise some parts of the current implementation.

ax-sc avatar Jun 24 '22 15:06 ax-sc