PgCMY

PgCMY — represents colors as combinations of cyan, magenta, and yellow.

Syntax

PgCMY(cyan_component, magenta_component, yellow_component)

		

Arguments

cyan_component

The cyan component of the desired color expressed as a number between 0-255 decimal (0x00-0xff hex).

magenta_component

The magenta component of the desired color expressed as a number between 0-255 decimal (0x00-0xff hex).

yellow_component

The yellow component of the desired color expressed as a number between 0-255 decimal (0x00-0xff hex).

Returns

A 24-bit number in the range 0x000000 - 0xffffff that represents the combination of the cyan_component, the magenta_component, and the yellow_component using the CMY color model.

Description

The CMY color model (classically known as the CMYK model) is a popular representation, especially for pigment-based, subtractive color processes like printing. The RGB color model, on the other hand, is additive. The RGB model is light-based, and works on adding color to black. For example, adding green light to blue light gives yellow light. Adding red, green, and blue light together gives white light. So, in the RGB model, the full value is white, represented as (255,255,255).

The CMY model, though, is subtractive, since it is pigment-based. Pigments absorb all light except the color reflected. Thus when you add pigments, you actually subtract color. For example, adding cyan, magenta, and yellow pigments will yield black. That means the full value of the CMY color model is black, with a value of (255,255,255).

Example

Gamma> WHITE = PgCMY(0,0,0);
0xfffff
Gamma> YELLOW = PgCMY(0,0,255);
0xffff00
Gamma> ORANGE = PgCMY(0,90,255);
0xffa500
Gamma> RED = PgCMY(0,255,255);
0xff0000
Gamma> MAGENTA = PgCMY(0,255,0);
0xff00ff
Gamma> BLUE = PgCMY(255,255,0);
0xff
Gamma> GREEN = PgCMY(255,0,255);
0xff00
Gamma> BLACK = PgCMY(255,255,255);
0x0
		

See Also

PgRGB, PgGray

and in Photon documentation: PgCMY.