A set of primary colors is a small, arbitrary set of pigmented physical media, lights or purely abstract elements of a mathematical colorspace model. Distinct colors from a larger gamut can be specified in terms of a mixture of primary colors which facilitates technological applications such as painting, electronic displays and printing. Any small set of pigments or lights are "imperfect" physical primary colors in that they cannot be mixed to yield all possible colors that can be perceived by the human color vision system. The abstract (or "imaginary") primaries X, Y and Z of the CIEXYZ colorspace can be mathematically summed to specify essentially all colors that can be perceived but these primaries cannot be physically realized due to the underlying structure and overlapping spectral sensitivities of each of the human cone photoreceptors. The precise set of primary colors that are used in a specific color application depend on gamut requirements as well as application-specific constraints such as cost, power consumption, lightfastness, mixing behavior etc.
In an additive set of colors, as in coincident projected lights or in electronic visual displays, the primary colors normally used are red, green and blue (but the precise visible light spectra for each color can vary significantly). In a subtractive set of colors, as in mixing of pigments or dyes for printing, the colors magenta, yellow and cyan are normally used. See RGB color model, and CMYK color model for more on these popular sets of primary colors.
Primary colors are not a fundamental property of light but are related to the color vision system in animals. The human eye normally contains only three types of color photoreceptors (L, M and S) that are associated with specialized cone cells. Each photoreceptor responds to different ranges of the visible electromagnetic spectrum and there is no single wavelength that stimulates only one photoreceptor type. Humans and other species with three such types of color photoreceptor are known as trichromats. In spite of color being a complex psychophysical response to electromagnetic radiation, controlled color matching experiments (e.g., CIE 1931) have essentially mapped all possible colors the eye can see in terms of the response of each of the three color photoreceptors, which correspond to the three dimensions of CIEXYZ. Color appearance models like CIECAM02 describe color more generally in six dimensions and can be used to predict how colors appear in different viewing conditions.