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.

By using the Color space menu, you can select either RGB or CMYK. To save a new color, click Add to palette.

The Color picker may be configured either globally, through the ~\Configuration\clientConfig.json file, or individually for each product, or even for a single page, using the IConfiguration interface. For the purposes of this article, we will configure the Color picker by using the IConfiguration interface.

You can specify the color spaces available to your users as follows:

JavaScript
configuration = {
    widgets: {
        ColorPicker: {
            defaultColorSpace: "cmyk",
            availableColorSpaces: ["rgb", "cmyk"]
        }
    }
};

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 for editing the fixed palette and disabling a continuous color selection. 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 colors:

A custom palette.

The following palette configuration defines these colors in the rgb and cmyk formats.

JavaScript
configuration = {
    widgets: {
        ColorPicker: {
            showPaletteOnly: true
            palette: [["rgb(0, 0, 0)","rgb(255, 255, 255)"],
                ["cmyk(0, 1, 1, 0, 1)","cmyk(0%, 0%, 100%, 0%, 100%)","rgb(0, 255, 0)","rgb(0, 255, 255)","rgb(0, 0, 255)","cmyk(0, 0.9, 0, 0, 1.0)"]]
        }
    }
};

When you have CMYK templates, you may find it important to specify colors in the CMYK color space. The previous example illustrates how you can specify CMYK components and an alpha channel in percentage and values in the range [0..1].

Note

You can specify CMYK colors in your palette in the deprecated device-cmyk format, where the first four values are the CMYK components in the range from 0 to 255 (similar to RGB). In this case, Customer's Canvas automatically converts CMYK colors to the RGB equivalents that the user sees on a screen. For example, device-cmyk(0, 255, 255, 0, 1, rgb(255, 0, 0))

See Also

Manual

IFrame API Reference