Saltar al contenido principal
Receta número 189

Recetario · Capítulo 10 · Salida e integración

Una quinta tinta para el color corporativo

Cuatricromía más un Pantone corporativo exacto: la tabla de tintas reúne en una plancha, PANTONE 286 C, cada nombre que recibe el azul.

En esta página
  • Formato 210 × 297 mm
  • 2 columnas, medianil de 7 mm
  • Source Serif 4 9,6/13,2
  • Source Sans 3
  • 8 páginas
  • Nivel
  • Postext 1.84.0
  • Compuesto en 159 ms
  • 298 líneas de código

En pocas palabras

Una memoria anual de una fundación que cuida un río, impresa con las cuatro tintas de siempre y un azul exacto que es el color de la fundación. Cada archivo llama al azul de una manera, y el de imprenta lo pone todo en una plancha.

Lo que vas a componer

Una memoria anual de ocho páginas A4 para una fundación inventada que restaura un río, impresa a cuatro tintas y una quinta, su azul corporativo. El azul está donde lo pondría una marca: la franja de la cubierta, la barra sobre cada sección, los títulos, las cabeceras de tabla, las barras del gráfico y la contracubierta. Sus tintes al 40 % y al 12 % rellenan las barras previstas, las filas de total y la caja de cifras, y se imprimen como tramas de la misma tinta, nunca como una mezcla de cuatricromía. Las fotografías y el texto van en cuatricromía. El PDF/X-4 tiene cinco planchas, y la quinta lleva el nombre con que el impresor guarda la tinta, PANTONE 286 C, aunque en el diseño nada la llama así.

Esta receta responde a

  • ¿Cómo imprimo una memoria a cuatro tintas y nuestro Pantone si cada archivo llama a la tinta de una manera?

La respuesta corta

script.js · líneas 20–37en el código completo
// The corporate blue as each source named it: the designer's swatch, an older palette that
// wrote it without the space, and the chart, drawn in Spanish, which says 'Azul Cauce'. The
// tints are the same ink at 40 % and 12 %: no process mix stands in for them.
const BLUE = { c: 100, m: 75, y: 0, k: 0 }; // what the ink looks like at 100 %, for a proof
const spot = (hex, name, tint) => ({ hex, model: 'spot', spot: { name, cmyk: BLUE, tint } });
const palette = {
  ink: { hex: '#1c2129', model: 'hex' }, // text, in process black
  muted: { hex: '#5d6573', model: 'hex' },
  blue: spot('#0033a0', 'Brand Blue'),
  blue40: spot('#99add9', 'Pantone 286C', 40),
  blue12: spot('#e0e6f3', 'Brand Blue', 12),
  ochre: { hex: '#c98a1b', model: 'hex' }, // the one process accent: the second data series
  paper: { hex: '#ffffff', model: 'hex' },
};
// The ink table: the plate's name is the printer's, and every other name prints on it.
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51', convertImages: false,
  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
    cmyk: BLUE }] };

Ingredientes

Tipografía
Source Serif 4, Source Sans 3 (SIL OFL 1.1)
Recursos
  • director-800.jpg
  • kingfisher-1050.jpg
  • meander-1120.jpg
  • sample-900.jpg
  • volunteers-1200.jpg
  • El río desde el aire, en la cubierta (Generated With Diffusion Models, original)
  • La directora en la orilla (Generated With Diffusion Models, original)
  • Voluntarios plantando estacas de sauce (Generated With Diffusion Models, original)
  • Una muestra de agua en una estación de aforo (Generated With Diffusion Models, original)
  • Un martín pescador en una rama de sauce (Generated With Diffusion Models, original)

Elaboración

#1 · Una tinta con tres nombres

El código es la respuesta corta de arriba. El azul llega a la memoria con tres nombres, como pasa en los trabajos de verdad: la muestra del diseñador dice Brand Blue, una paleta antigua escribió Pantone 286C para el tinte al 40 %, y el gráfico, dibujado en la oficina de España, dice Azul Cauce. Sin tabla de tintas cada nombre saldría en su propia plancha, y el impresor recibiría tres azules que mezclar. La entrada de la tabla de tintas da nombre a la plancha y pone los demás como alias; los nombres se comparan sin mirar mayúsculas ni espacios, así que cada tinte de cada nombre cae en la única separación PANTONE 286 C. Su cmyk es la alternativa que enseña una prueba.

#2 · El gráfico nombra su tinta

script.js · líneas 327–370en el código completo
// Kilometres of bank restored each year: the bars in the blue (data-spot="Azul Cauce"), the
// plan in its 40 % tint, the labels in process black. An alias brings both onto the plate.
const YEARS = [[2021, 3.1, 4], [2022, 4.6, 5], [2023, 6.2, 6], [2024, 7.4, 8], [2025, 9.8, 9]];
function chartArt() {
  const [W, H, BASE, LEFT, MAX] = [84, 56, 46, 8, 12];
  const y = (v) => BASE - (v / MAX) * (BASE - 4);
  const lines = [0, 4, 8, 12].map((v) => `<path d="M${LEFT} ${y(v)}H${W}" stroke="#c4cad4" `
    + `stroke-width="0.2"/><text x="${LEFT - 1.5}" y="${y(v) + 1}" font-size="2.6" `
    + `text-anchor="end" fill="#5d6573">${v}</text>`).join('');
  const bars = YEARS.map(([year, done, plan], i) => {
    const x = LEFT + 3 + i * 15;
    return `<rect x="${x}" y="${y(plan)}" width="5" height="${BASE - y(plan)}" fill="#99add9" `
      + `data-spot="Azul Cauce" data-spot-tint="40"/><rect x="${x + 5.6}" y="${y(done)}" `
      + `width="5" height="${BASE - y(done)}" fill="#0033a0" data-spot="Azul Cauce"/>`
      + `<text x="${x + 5.3}" y="${BASE + 5}" font-size="2.8" text-anchor="middle" `
      + `fill="#1c2129">${year}</text>`;
  }).join('');
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${W * 10}" height="${H * 10}" `
    + `viewBox="0 0 ${W} ${H}" font-family="'Source Sans 3'">${lines}${bars}</svg>`;
}
// Where each euro went: one bar across the text block, the river in the full ink, schools in
// its 40 % tint, the running costs in process grey.
const SPENT = [[1520, '#0033a0', 100, t({ en: 'Work on the river', es: 'Obras en el río' })],
  [340, '#99add9', 40, t({ en: 'Schools', es: 'Escuelas' })],
  [180, '#9aa1ad', 0, t({ en: 'Running costs', es: 'Funcionamiento' })]];
function euroArt() {
  const [W, H] = [174, 22];
  const total = SPENT.reduce((sum, [v]) => sum + v, 0);
  let x = 0;
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${W * 10}" height="${H * 10}" `
    + `viewBox="0 0 ${W} ${H}" font-family="'Source Sans 3'">`
    + `${SPENT.map(([v, hex, tint, name], i) => {
      const w = (v / total) * W;
      const ink = tint ? ` data-spot="Azul Cauce" data-spot-tint="${tint}"` : '';
      const end = i === SPENT.length - 1; // the last label sets flush right, under its segment
      const tx = `x="${end ? W : x}" text-anchor="${end ? 'end' : 'start'}"`;
      const part = `<rect x="${x}" y="0" width="${w - 0.6}" height="10" fill="${hex}"${ink}/>`
        + `<text ${tx} y="15.5" font-size="3.2" font-weight="700" fill="#1c2129">`
        + `${Math.round((v / total) * 100)} %</text><text ${tx} y="20" font-size="2.8" `
        + `fill="#5d6573">${name}</text>`;
      x += w;
      return part;
    }).join('')}</svg>`;
}

Un SVG dice en qué tinta se imprime un color con data-spot, y con qué fuerza con data-spot-tint, en porcentaje. Las barras del gráfico nombran Azul Cauce al 100 % y al 40 %, y el alias las pone en la misma plancha que el resto del azul. Las líneas de la rejilla y las etiquetas son colores corrientes y quedan en el negro de cuatricromía. La barra de gastos de la página de cuentas hace lo mismo con tres tramos, el tercero un gris de cuatricromía.

#3 · El azul lleva el diseño

script.js · líneas 55–73en el código completo
const BAND = 172; // mm from the top of the bleed to the top of the blue band
const cover = { id: 'cover', numbered: false, toc: false, span: 'page',
  header: { elements: [] }, footer: { elements: [] },
  margins: { top: mm(0), bottom: mm(0), left: mm(0), right: mm(0) },
  advancedDesign: { enabled: true, minHeight: mm(TRIM_H), slot: { elements: [
    { kind: 'image', id: 'photo', resourceId: 'meander', fit: 'cover',
      placement: at('bleed', 'top-left', 0, 0, { width: 'fill', height: mm(BAND + 1) }) },
    { kind: 'box', id: 'band', style: { backgroundColor: col('blue') },
      placement: at('bleed', 'top-left', 0, BAND, { width: 'fill', height: mm(TRIM_H) }) },
    text('name', '{author}', label(10, col('paper')), at('page', 'top-left', 20, BAND + 14)),
    text('title', '{titleText}', { fontFamily: SANS, fontWeight: 800, fontSize: pt(46),
      lineHeight: 1, color: col('paper') }, at('#name', 'below', 0, 6, { width: mm(170) })),
    { kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(3), color: col('blue40'),
      placement: at('#title', 'below', 0, 7, { width: mm(24) }) },
    text('strap', '{attr.strap}', { fontFamily: 'Source Serif 4', italic: true, fontSize: pt(15),
      lineHeight: 1.3, color: col('paper') }, at('#rule', 'below', 0, 6, { width: mm(120) })),
    text('credit', '{attr.credit}', { fontFamily: SANS, fontSize: pt(7), color: col('blue40') },
      at('page', 'bottom-left', 20, -14, { width: mm(170) })),
  ] } } };

La foto de cubierta llena la parte alta del sangrado con fit: 'cover', y una caja en el azul llena el resto; la letra encima es blanca y calada en la plancha. Las barras de sección, los pies de página y las cabeceras de tabla usan la misma entrada de la paleta, así que cambiar de tinta es una línea.

script.js · líneas 314–323en el código completo
// A row whose first cell is bold is a total: it takes the tint. Figures align right.
function tsvTable(tsv, columnWidths) {
  let m = Object.assign(parseTSV(tsv, { headerRows: 1 }), { columnWidths });
  m.rows.forEach((row, r) => row.forEach((_, c) => {
    if (c > 0) m = setAlignment(m, { row: r, col: c }, 'right', 'middle');
    if (r && row[0].content.startsWith('**')) m = setCellBackground(m, { row: r, col: c },
      col('blue12'));
  }));
  return m;
}

Las tablas salen de archivos TSV junto al texto. Una fila cuya primera celda va en negrita es un total y toma el tinte al 12 %; las cifras van a la derecha.

#4 · Las fotografías siguen en RGB

convertImages: false en los ajustes de impresión deja las fotografías como JPEG en RGB con perfil sRGB, que PDF/X-4 admite; el RIP del impresor las separa. El archivo queda ligero, y la plancha azul no recibe nada de las fotos.

La receta completa

Sandbox
// ═══ Postext Cookbook · Nº 189 · A fifth ink for the corporate colour ═══════════════════
// https://postext.dev/en/cookbook/corporate-fifth-ink-report
// Code: MIT · Text: original (CC BY 4.0) · Photographs: diffusion models
// Fonts: Source Serif 4, Source Sans 3 (SIL OFL 1.1) · Needs postext ≥ 1.84.0
//
// An annual report printed in four colours and one exact corporate blue. The palette, the
// chart and an older swatch call the blue by three names; the ink table gathers them on one
// plate named as the printer stocks the ink, PANTONE 286 C.
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, parseTSV, setCellBackground,
  setAlignment, inlineSvgFonts,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'es'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'corporate-fifth-ink-report';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region answer: one spot ink, three names: the ink table puts them on one plate
// The corporate blue as each source named it: the designer's swatch, an older palette that
// wrote it without the space, and the chart, drawn in Spanish, which says 'Azul Cauce'. The
// tints are the same ink at 40 % and 12 %: no process mix stands in for them.
const BLUE = { c: 100, m: 75, y: 0, k: 0 }; // what the ink looks like at 100 %, for a proof
const spot = (hex, name, tint) => ({ hex, model: 'spot', spot: { name, cmyk: BLUE, tint } });
const palette = {
  ink: { hex: '#1c2129', model: 'hex' }, // text, in process black
  muted: { hex: '#5d6573', model: 'hex' },
  blue: spot('#0033a0', 'Brand Blue'),
  blue40: spot('#99add9', 'Pantone 286C', 40),
  blue12: spot('#e0e6f3', 'Brand Blue', 12),
  ochre: { hex: '#c98a1b', model: 'hex' }, // the one process accent: the second data series
  paper: { hex: '#ffffff', model: 'hex' },
};
// The ink table: the plate's name is the printer's, and every other name prints on it.
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51', convertImages: false,
  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
    cmyk: BLUE }] };
// #endregion
const col = (id) => ({ ...palette[id], paletteId: id });
const colorPalette = [...Object.entries(palette).map(([id, value]) => ({ id, name: id, value })),
  { id: 'main-color', name: 'blue (defaults)', value: palette.blue }];

const [TRIM_W, TRIM_H] = [210, 297]; // A4
const MARGIN = { top: 24, bottom: 24, inner: 20, outer: 16 };
const LEAD = 13.2; // pt
const SANS = 'Source Sans 3';
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
  offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });

El script.js compuesto funciona tal cual: pégalo como script de módulo en cualquier página o abre la receta en CodePen. Carpeta de la receta en GitHub ↗ (se abre en una nueva pestaña)

Variantes

#Imprime el azul en cuatricromía

Cuando la máquina no tiene quinto cuerpo, una palabra en la tabla de tintas imprime cada tinte del azul en CMYK a partir de su alternativa.

-  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
-    cmyk: BLUE }] };
+  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
+    cmyk: BLUE, output: 'process' }] };

#Nombra la plancha para otra imprenta

Hay imprentas que quieren la plancha con su propio nombre. pdfName la renombra y conserva los alias.

-  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
+  inks: [{ name: 'PANTONE 286 C', pdfName: 'PANTONE 286 U', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],

Errores frecuentes

  • Un color de una imagen que ni nombra su tinta ni coincide exactamente con un color plano de la paleta queda en cuatricromía, aunque parezca el azul. Marca los elementos con data-spot, o da a la paleta un color plano con ese hex exacto.
  • Un nombre de familia con un número, como Source Sans 3, necesita comillas en el font-family de un SVG; sin ellas, el navegador descarta la declaración y compone las etiquetas en una serif.

Créditos

Texto
Texto original, CC BY 4.0
Imágenes
  • El río desde el aire, en la cubierta · Generated With Diffusion Models · original
  • La directora en la orilla · Generated With Diffusion Models · original
  • Voluntarios plantando estacas de sauce · Generated With Diffusion Models · original
  • Una muestra de agua en una estación de aforo · Generated With Diffusion Models · original
  • Un martín pescador en una rama de sauce · Generated With Diffusion Models · original
Fuentes
Source Serif 4 (SIL OFL 1.1) · Source Sans 3 (SIL OFL 1.1)
SandboxPDF