CMYK notation fallback with RGB conversion
Opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
This request is not addressing an immediate issue, but rather a future enhancement or suggestion. Feel free to close it if not so appropriate.
Describe the solution you'd like
It could be beneficial for Vivliostyle to parse a form of CMYK color notation like device-cmyk()
or cmyk()
and provide a fallback to RGB as alpha-support, regardless of whether browsers natively support CMYK colors. While this wouldn't currently produce the most accurate results, it could help maintain visual consistency with other CSS typesetting engines. Moreover, the effort would still be valuable when proper CMYK support is implemented in the future.
The CSS Color Module Level 5 offers a basic method for converting CMYK to RGB, which might be sufficient as a temporary solution:
Describe alternatives you've considered
Using a color management library like Little CMS could provide more accurate conversions. However, this might require more complex steps. (such as using Emscripten or so?)
Additional context
I recommend using device-cmyk()
color with RGB fallback as follows:
.C100 {
color: rgb(0% 100% 100%); /* fallback */
color: device-cmyk(100% 0% 0% 0%);
}
It works not only in Vivliostyle and other CSS typesetting engines but also in normal browsers.
Interpreting device-cmyk()
color using the naive conversion algorithm may be useful for some cases, but I am not sure we should implement it in Vivliostyle. It is not supported in browsers, and I think it is not good if people misunderstand that Vivliostyle really supports device-cmyk color.
I agree with your point about the possibility of people misunderstanding.