Colors

When editing texts and vector elements in the editor, you can change the fill or outline colors. The following color picker is used for this purpose:

The color picker.

When you print certain products, you may want to limit the colors available to a user by a specific list of values, corresponding to the spot colors of your printer. Customer's Canvas allows editing the fixed palette and disabling a continuous color selection.

The Color picker may be configured either globally, through the ~\Configuration\clientConfig.json file, or individually for each product, or even for a separate page, using the IConfiguration interface.

For the purposes of this article, we will configure the Color picker using the IConfiguration interface.

First, let us turn off the continuous color selection functionality and leave only the palette:

JavaScript
configuration = { widgets: {ColorPicker: {showPaletteOnly: true}}};

Now we can configure the palette. To do this, we should set up the ColorPicker.palette property. It accepts a JSON two-dimensional array of colors in a css-compatible format. Let us assume that we want to display the following palette:

A custom palette.

The corresponding configuration is as follows:

JavaScript
configuration = { widgets: {
    ColorPicker: {
        showPaletteOnly: true,
        palette: [["rgb(0, 0, 0)","rgb(255, 255, 255)"],
                  ["rgb(255, 0, 0)","rgb(255, 255, 0)","rgb(0, 255, 0)","rgb(0, 255, 255)","rgb(0, 0, 255)","rgb(255, 0, 255)"]]
    }}};

When you have CMYK templates, you may find it important to specify not just RGB values but precise CMYK equivalents for them. This way you do not have to convert CMYK <-> RGB to be sure that you will always have exactly those colors you expect. You can do it using the device-cmyk function:

device-cmyk(22, 85, 58, 3, 1, rgb(230, 184, 175))

The first four values are the CMYK components (similar to rgb), the fifth value is an alpha channel (i.e. the color opacity in range [0..1]) and the last one is an RGB equivalent the user will see on a screen.

Note Be careful! It is your responsibility to specify a correct color. If your CMYK color is, for example, green while your RGB value is yellow, the user will be misled as they will expect that you will print yellow. That is why you should carefully pick all values, e.g. using Adobe Photoshop.

See Also

Manual

IFrame API Reference