Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMYK notation fallback with RGB conversion #1379

Open
u1f992 opened this issue Sep 20, 2024 · 2 comments
Open

CMYK notation fallback with RGB conversion #1379

u1f992 opened this issue Sep 20, 2024 · 2 comments

Comments

@u1f992
Copy link

u1f992 commented Sep 20, 2024

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

@MurakamiShinyu
Copy link
Member

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.

@u1f992
Copy link
Author

u1f992 commented Sep 24, 2024

I agree with your point about the possibility of people misunderstanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@MurakamiShinyu @u1f992 and others