APUtility

Custom color formats

iPalette Pro allows you to define custom formats for color values. A common format is #FFFFFF and can be defined in iPalette as #%XR%XG%XB. If you are a Cocoa developer you can create an NSColor format as follows: [NSColor colorWithCalibratedRed:%3r green:%3g blue:%3b alpha:1.0]. The table below describes the tokens available to use when creating custom formats.

Token
Description

%Xr, %Xg, %Xb

Lowercase hex value of color component.

Example output: 3f, ee, 12

%XR, %XG, %XB

Uppercase hex value of color component.

Example output: 3F, EE, 12

%xr, %xg, %xb

Lowercase hex value of color component and short hex whenever possible.

Example output: 3f, e, 12

%xR, %xG, %xB

Uppercase hex value of color component and short hex whenever possible.

Example output: 3F, E, 12

%0r, %0g, %0b

Integer value of color component on the scale of 0 - 255.

Example output: 182, 255, 0, 23

%[1-5]r, %[1-5]g, %[1-5]b

Decimal value of color component with up to 5 decimal places.

Example output: 1.00, 0.4235, 0.134, 0.0

%n

Name of the color.

%%

The '%' character.

Note:Putting a 'w' after '%' will give the websafe value of the color component. For example %w0r, %wXg, %w2b, etc.