[Tex/LaTex] Define colour transparency in relation to existing colour



Using ConTeXt to develop a nice theme where users can change the colour scheme, but still get the same "feeling" for the output, primary, secondary, and tertiary colours are defined. For example:


Each colour can then be "lightened" by setting its transparency:


This works but is not ideal.


The ColourSecondary value of 9A957A is repeated for the lighter colours, resulting in triplicated code.


How do you create a transparent variation on an existing colour?

For example:


The following did not work:



Best Answer

Use a spot colour instead. Spot colours can be defined using three arguments instead of two arguments, like \definecolor. The first argument is the colour to define. The second argument is the colour to be use as a base. And the third argument takes the same options as \definecolor.

\definecolor     [ColourSecondary]             [h=9A957A]
\definecolor     [ColourSecondaryLighter]      [h=9A957A, a=1, t=.5]
\definecolor     [ColourSecondaryLightest]     [h=9A957A, a=1, t=.3]
\definespotcolor [ColourSecondaryLighterSpot]  [ColourSecondary]     [a=1, t=.5]
\definespotcolor [ColourSecondaryLightestSpot] [ColourSecondary]     [a=1, t=.3]

\setupblackrules [height=1cm, width=5cm]



%% defined using \definecolor

%% defined using \definespotcolor