Color Palette
The ZX Spectrum (and compatibles) computers uses a variation of the 4-bit RGBI palette philosophy. This results in each of the colors of the 3-bit palette having a basic and bright variant, with the exception of black. The bright half of the palette is generated using the video display's maximum voltage levels for each of the three R/G/B color components that a color uses. The basic half of the palette is displayed by simply reducing these voltages.
Unlike most RGBI palettes, the ZX Spectrum swaps the color components around a bit: Blue has a binary weight of 1, Red has a weight of 2, while Green has a weight of 4. As with any binary number, these weights add up to produce a single decimal number that matches the displayed color, the effect of which can be seen in the table below (pay special attention to the "binary value" column).
For any value of n from 0 to 7, the following commands can be used to set or alter the screen's colors:
- BORDER n, the color for surrounding area outside the main bitmap.
- PAPER n, the background (pixel bit value of 0) color for the color cell to be altered.
- INK n, the foreground (pixel bit value of 1) color for the color cell to be altered.
Furthermore, the BRIGHT command can be used to change the setting of the PAPER and INK commands' "bright" flag (the I in RGBI), giving them access to the entire 15-color palette. Settings of "0" and "1" turn bright mode off and on (respectively). Since only one bit within a color attribute byte is used to select the brightness for both foreground and background colors in a color cell, it is not possible to select both bright and basic color modes in the same color cell. The BORDER command does not use a bright flag, thus only the eight basic colors are supported.
Counting from least to most significant bit, an attribute byte dedicates three bits for the foreground color, three bits for the background color, one bit for the bright flag, and one bit for the flashing effect (which causes the video display to alternate foreground and background colors periodically).
-
Color number Binary value BRIGHT 0 (RGB) BRIGHT 1 (RGB) Color name 0 000 #000000 #000000 black 1 001 #0000CD #0000FF blue 2 010 #CD0000 #FF0000 red 3 011 #CD00CD #FF00FF magenta 4 100 #00CD00 #00FF00 green 5 101 #00CDCD #00FFFF cyan 6 110 #CDCD00 #FFFF00 yellow 7 111 #CDCDCD #FFFFFF white
Read more about this topic: ZX Spectrum Graphic Modes
Famous quotes containing the words color and/or palette:
“The intellect,that is miraculous! Who has it, has the talisman: his skin and bones, though they were of the color of night, are transparent, and the everlasting stars shine through, with attractive beams.”
—Ralph Waldo Emerson (18031882)
“The great God endows His children variously. To some he gives intellectand they move the earth. To some he allots heartand the beating pulse of humanity is theirs. But to some He gives only a soul, without intelligenceand these, who never grow up, but remain always His children, are Gods fools, kindly, elemental, simple, as if from His palette the Artist of all had taken one color instead of many.”
—Mary Roberts Rinehart (18761958)