Skip to content

[css-color] Separation / DeviceN color support #2023

@faceless2

Description

@faceless2

EDIT: first few posts superceded, please skip to #2023 (comment)


It's unclear how to define what are called "DeviceN" colors in PDF in css-colors-4, or even if it's possible. This is a concern for us as we develop our CSS to PDF converter, as ideally we would like to see css-colors cover the full gamut (ahem) of color spaces available in PDF.

The option to supply named strings to the color() function is, I presume, intended to enable spot colors. Without an example it's hard to see how this will work, but the current syntax

color() = color( [ <ident>? [ <number>+ | <string> ] [ / <alpha-value> ]? ]# , <color>? )

seems to imply something like this:

color: color(profilename "Pantone Reflex Blue CVC", lab(26.18 18.64 -59.95));

Only a single string is allowed, which means I am limited to using only one ink: from a PDF point-of-view I can define only a Separation color, not the more general DeviceN color. Also, I still have to specify the profile (or have it default to sRGB), which makes no sense in this context: If the device has the named ink, it will be used; if it doesn't, the fallback (which defines its own color space) will be used. Either way the ICC profile, defined here as "profilename", is unused.

Finally, I have no means of specifying how much ink. When specifying CMYK, for example, I can specify 80% cyan, 20% magenta. But this syntax doesn't allow that. I can name the ink, but that's it (and the quantity of ink is distinct from the alpha value; if we ignore overprinting, 0% black is not transparent; it's white).

I think this is easy to improve upon, but it might be better in a new function instead of overriding color(). A syntax like this:

color: separation("Pantone Reflex Blue CVC" 50%, lab(26.18 18.64 -59.95));

would allow you to specify the level of ink (50%), which the current syntax doesn't. You could also use multiple inks:

color: separation("Cyan" 0.8 "Magenta" 0.4 "Yellow" 0 "Black" 0 "Pantone Hexachrome Cyan C" 0.2 "PANTONE 1505 C" 0.4 "PANTONE 1355 C" 0 "PANTONE 1365 C" 0 PANTONE 7468 C" 0 PANTONE 476 C" 0, lab(80 -20 -40));

With nine inks that may look ridiculous, but it's an actual ColorSpace extracted from a PDF document in our test corpus. The syntax I had in mind here is:

separation ( [ string number-or-percentage ] {1,n} , color )

The concepts here directly translate to the DeviceN color space in PDF, which means that css-color-4 could represent any block color used in PDF.

(Also, by specifying the component values of all the inks, even the unused ones, it means using colors like this in a linear-gradient has a fairly well-defined solution, assuming the inks are the same on both sides of the gradient.)

Sorry if this has been discussed elsewhere, I didn't find mention of it here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions