Colors

IDML-Creator supports process colors, spot colors, and tint colors.

Process and Spot Colors

Set up a Colors object and add it to the Content object like that:

<?php

use IDML\Content\Color\Color;

$myColor = new Color(); 

$content->addColor($myColor);

If you want to set your own unique identifier – which is recommended here –, set up the Color like that: new Color('UniqueName');

A color object can be set to styles an other elements, for example:

<?php 

$myParagraphStyle->setFillColor($myColor);

Setting the color model

The color model can be set with the help of the Color Model Enum.

<?php

use IDML\Content\Enum\Color\Model;

/**
 * This will create a process color 
 */
$myColor->setModel(Model::PROCESS());

/**
 * This will create a spot color 
 */
$myColor->setModel(Model::SPOT());

Setting the color space

The color space can be set with the help of the Color Space Enum.

<?php

use IDML\Content\Enum\Color\Space;

/**
 * This will set the space to RGB 
 */
$myColor->setSpace(Space::RGB());

/**
 * This will set the space to CMYK 
 */
$myColor->setModel(Space::CMYK());

/**
 * This will set the space to LAB 
 */
$myColor->setModel(Space::LAB());

Tint Colors

Tint Colors are a percentual part of a process or spot color. You need a process or spot color to create a tint color.

Set up a Tint object and add it to the Content object like that:

<?php 

use IDML\Content\Color\Color;
use IDML\Content\Color\Tint;

$myColor = new Color('myColor'); 
$myTintColor = new Tint($myColor);

$content->addTint($myTintColor);

A tint color object can be set to styles an other elements, for example:

<?php 

$myParagraphStyle->setFillColor($myTintColor);

Tint value

<?php 

/**
 * This will define a Tint Color with a value of 50% 
 */
$myTintColor->setTintValue(50);