glu
Color

Color

On screen a color is light, on paper it is ink. A print file says which inks to use and how much of each. In glu that happens in CSS, with colors you define once and use by name.

CMYK and named colors

CSS takes CMYK directly, in cmyk() and device-cmyk(). For a job with a few inks, @-bag-color gives each one a name, so all rules use the name, and a change of ink is a change in one place:

@-bag-color brand { model: cmyk; c: 0; m: 80; y: 90; k: 10; }

h1 { color: brand; }

The name works in every property that takes a color, and in the fill and stroke of an SVG image: a logo can use the ink of the document. A name you define also wins over a color name of SVG, so with @-bag-color black a fill="black" is your black. Colors such as #000 stay RGB. The CSS reference lists all descriptors.

Spot colors

A spot color is an ink of its own, mixed in advance, with a printing plate of its own. Define it with the model spotcolor:

@-bag-color blue {
    model: spotcolor;
    colorname: "PANTONE 300 C";
    c: 100; m: 44; y: 0; k: 0;
}

colorname is what the print shop sees, so it has to match their ink. The c, m, y and k values are the fallback for screens and for printers without that ink.

Overprint

By default a color knocks out what is below it: the plates of the lower color stay empty in the shape of the upper one. For small black text on a tint that is a risk, because the plates never meet exactly, and a slight misregister leaves a white edge along the letters.

With overprint: yes the color prints on top instead:

@-bag-color ink { model: cmyk; c: 0; m: 0; y: 0; k: 100; overprint: yes; }

body { color: ink; }

Overprint has a few rules:

  • It works with CMYK and spot colors. RGB and gray colors knock out even with overprint: yes, and so does the CSS color black. glu warns.
  • A CMYK color prints only on the plates of its nonzero components, so white with overprint disappears. glu warns.
  • A PDF viewer shows the effect only with overprint preview switched on.
  • From Lua, set overprint on a color, see the Lua API.

RGB in print

In a PDF/X file, RGB colors and pictures count as sRGB, and the print shop converts them to its inks. That is valid, and fine for pictures from a camera. Where the exact color matters, such as for a logo or for text, use CMYK or a spot color.

Look at the plates

Ghostscript writes one image per ink, so you can see what each plate prints before the press does:

gs -q -o plate.tif -sDEVICE=tiffsep -r100 flyer.pdf

This produces plate(Cyan).tif, plate(Magenta).tif, plate(Yellow).tif, plate(Black).tif and one file per spot color, such as plate(PANTONE 300 C).tif. Dark means ink.

Go through them with these questions:

  • Is a spot color where you expect it, and only there?
  • Does the black text stand on a tint without a hole in the tint below it? Then it overprints.
  • Are the crop marks on every plate? They should be.

Adobe Acrobat shows the same in its output preview, with one switch per plate.

The plates of a flyer: the tint runs through below the black text, the band stands on the spot color alone

Limits

  • A color can have an alpha value, such as rgba(200,0,0,.5), rgb(200 0 0 / 50%), #c8000080 or device-cmyk(0 1 1 0 / 50%), for text, backgrounds and borders. It applies to that color alone, so text with a transparent background stays opaque. opacity on a block or a table makes the whole box transparent instead: background, border and text are painted as one object, and the background does not shine through the text. An overprinting color in such a box still overprints what lies below it. Images and inline svg take opacity too, inline elements and table cells do not.
  • PDF/X-3 forbids transparency. There glu warns and paints transparent colors opaque. PDF/X-4 and PDF/A-3b allow it. For print, a tint of the color is still the safer choice: the printer’s workflow flattens transparency, a tint needs nothing of that.
  • The stops of a gradient in an SVG image are RGB. A defined color does not work there, glu warns and the stop is black.