Farbtafeln mit InDesign

Manchmal geht probieren über studieren. Zum Beispiel wenn man eine neue Sonderfarbe mit Euroskala-Farben überdrucken möchte. Zwar gibt es am Bildschirm eine „Überdruck simulieren“ Funktion, jedoch ist diese nicht zuverlässig (das kann verschiedene Gründe haben, z.B. ein zu kleiner Farbraum des Bildschirms). Auch ein Digitalproof kann nur bedingt das tatsächliche Druckergebnis simulieren (auch hier kann der Farbraum zu klein sein). Sonderfarben verhalten sich manchmal im Überdruck mit anderen Farben ganz anders als erwartet (durch Rückspaltung usw.)

Es gibt also Situationen, in denen man um einen Probedruck nicht herum kommt. Praktisch wäre eine Farbtafel, die alle Nuancen der Sonderfarbe im Überdruck mit den Euroskala-Farben enthält. Solch eine Farbtafel kann man natürlich manuell mit z.B.  InDesign herstellen. Das ist aber mühsam und langweilig.

Spannender und weitaus produktiver wirds mit einem InDesign-Script. InDesign versteht zwei Scriptsprachen: AppleScript und Javascript. Ich nutze Javascript aus Gründen (vor allem, weil ich keine teuren Äpfel mag).
Das Script erzeugt ein neues Dokument und erstellt Seiten im Format 21x21cm und plaziert darauf die Testfelder. Pro Feld wird ein neues Farbfeld angelegt. Pro Sonderfarb-Abstufung muss zusätzlich ein Tint erstellt werden und das Atrribut „Fläche überdrucken“ auf das Rechteck angewendet werden.

Nach wenigen Sekunden zeigt InDesign die fertige Farbtafel an:

Farbtafel Simulation
Farbtafel Cyan/Magenta und simulierter Sonderfarbe

Das ist der Quellcode zum Erzeugen der Tafel, das Script im InDesign Scripting-Panel ablegen:

/**
 *  Farbtafeln erstellen
 *  change variables below according to your needs
 */

main();
function main (){

	// define page size in mm
	var pw = 210;
	var ph = 210;

	// define number of boxes in x and y direction
	var num_row = 21;
	var num_col = 21;
	
	var stepX = (pw-10) / num_col; // size of one box, less 5mm page margin
	var stepY = (ph-10) / num_row;

	// create document
	var doc = app.documents.add({
			documentPreferences:{
				pageHeight:ph,
				pageWidth:pw,
				facingPages:false // for simplicity don´t create facing pages
			}
	});
	var pg = doc.pages.item(0); // get the page
	
	// define initial coordinates for first box
	var x1 = stepX / 2.0;
	var y1 = stepY / 2.0;
	var x2 = x1 + stepX;
	var y2 = y1 + stepY;

	
	// define colors and paperwhite
	var cyan = 0;
	var magenta = 0;
	var yellow = 0;
	var black = 0;
	var paper = color_add (doc, "paper color ["+0+";"+0+";"+0+";"+0+"]", ColorModel.PROCESS, [0, 0, 0, 0]);
	
	// define spot color
	var special =doc.colors.add();
    special.properties = {
            name:"AndiGun Spezialtoner", 
            model:ColorModel.SPOT,
            space:ColorSpace.CMYK,
            colorValue:[0,0,100,0] // alternate color is 100% yellow
			};
			
	// define text color
	var text =doc.colors.add();
    text.properties = {
            name:"Text", 
            model:ColorModel.PROCESS,
            space:ColorSpace.CMYK,
            colorValue:[0,0,0,100] // 100% black
		};
	
	// start procedure
	for (var i = 0; i < num_col; i++) { // for each column
		for (var j = num_row-1; j >= 0; j--) { // for each row
			
			// adjust as needed
			cyan = (j*5);
			magenta = (i*5);
			//black = j*5;
			
			var color_name = "cmyk color ["+cyan+";"+magenta+";"+yellow+";"+black+"]";
            
              if (i == 0) {
                        var newTextFrame = pg.textFrames.add(); 
                        newTextFrame.contents = cyan+""; 
                        newTextFrame.textFramePreferences.verticalJustification = VerticalJustification.CENTER_ALIGN;
                        var myText = newTextFrame.parentStory.paragraphs.item(0);
                        myText.pointSize = 8;
                        myText.justification = Justification.CENTER_ALIGN;  
                        newTextFrame.geometricBounds = [0, x1 , stepY/2, x2]; // Top, Left, Bottom, Right 
              }            
          
			var color = color_add (doc, color_name, ColorModel.PROCESS, [cyan, magenta, yellow, black]);
			
			var rect = pg.rectangles.add({geometricBounds:[y1,x1,y2,x2]});
			rect.fillColor = color;
			rect.strokeWeight = 1;
			rect.strokeColor = paper;
			x1 = x2;
			x2 = x2 + stepX;
		} // end of row
		
		y1 = y2;
		y2 = y2 + stepY;
		x1 = stepX / 2.0;
		x2 = x1 + stepX;
		
	} // end of columns
	
	var tint = 0;
    x1 = stepX / 2;
	y1 = stepY / 2;
	x2 = x1 + stepX;
	y2 = y1 + stepY;    
    
	// create array of tints for special color
    var tints = Array();
       for (var i = 1; i < num_col-1; i++) {
               var specialTint = doc.tints.add (special);
               specialTint.tintValue = i * 5;
               tints[i] = specialTint;
           }
    
    for (var i = 0; i < num_col; i++) {
		for (var j = num_row-1; j >= 0; j--) {
			    
			tint = i*5;
			
            if (j == 0) {
                        var newTextFrame = pg.textFrames.add(); 
                        newTextFrame.contents = tint+""; 
                        newTextFrame.textFramePreferences.verticalJustification = VerticalJustification.CENTER_ALIGN;
                        var myText = newTextFrame.parentStory.paragraphs.item(0);
                        myText.pointSize = 8;
                        myText.justification = Justification.CENTER_ALIGN;  
                        newTextFrame.geometricBounds = [y1, x2 , y2, x2+stepX/2]; // Top, Left, Bottom, Right 
              }            
                
              if (tint > 0) { // tints have to be greater than 0
                var rect = pg.rectangles.add({geometricBounds:[y1,x1,y2,x2]});
                if (tint < 100) { 
                     rect.fillColor = tints[i];    
                     }
                 else { // with 100% it´s not a tint, it´s the actual color
                     rect.fillColor = special;    
                     }
                     
                rect.overprintFill=true; // set overprint flag
                rect.strokeWeight = 1;
                rect.strokeColor = paper;
            }
			x1 = x2;
			x2 = x2 + stepX;
            
		}
		y1 = y2;
		y2 = y2 + stepY;
		x1 = stepX / 2.0;
		x2 = x1 + stepX;
	}
	
}; // end of function main

/*
* function adds color swatch to document and returns color
*/
function color_add(myDocument, myColorName, myColorModel, myColorValue){
	
	if(myColorValue.length == 3) myColorSpace = ColorSpace.RGB;
	else myColorSpace = ColorSpace.CMYK;
	
	myColor = myDocument.colors.item(myColorName);
	myColor = myDocument.colors.add();
	myColor.properties = {name:myColorName, model:myColorModel, space:myColorSpace ,colorValue:myColorValue};
	
	return myColor;
}