Palette variables

If a color palette is defined the Tools menu will contain an entry for generating variables for the defined colors. The variables can be used as arguments in commands that select a color.

The dialog contains the following:

  • The Mapping name is the name of the custom mapping that will be created or updated. This must follow the convention for a custom mapping: it must start with ‘%’ and an upper-case letter.

  • The Variable name prefix is used to create the names of the variables. It must start with an upper-case letter and contain only characters allowed in variable names. It may be empty.

  • If the custom mapping already exists the Overwrite existing mapping checkbox is enabled. You must select it to allow the mapping to be overwritten.

When OK is pressed the commands to create the variables are written to the custom content of the mapping. Any existing custom content is replaced.

Each variable name is constructed by appending the prefix, the string “RGB” and a modified version of the color name. Characters not allowed in variable names are removed, and runs of spaces are replaced by an underscore.

Colors with the default name (#RRGGBB) do not create variables. Note that because some characters in the names are removed it is possible for variable names to be duplicated. For example, colors named “green*” and “green+” will create the same variable name.

The recommended way of defining the variables is by adding a reference to the custom mapping in $document.