36

Although subjective, I believe I'm not the only one considering default VGA 256 color palette to be hideous and ugly.

What is the story behind this, why were these particular colors chosen?

14
  • 6
    some colors are for compatibility with older gfx like EGA,CGA and the rest is a compromise between usually needed colors for Apps at that time and color dithering purposes so you can have "hi" quality images on the same palette to ease up the apps speed ... for really high quality image output you need combine quantization and dithering... so n the end is not about how ugly the palette looks but how usable it is
    – Spektre
    Nov 8 at 6:51
  • 1
    @golimar: The question is about the default VGA palette though. Most developers and artists at the time did indeed consider the default inappropriate for their needs and used customized palettes instead. I'd go so far as to say that it was the fact that you could customize the palette that made it possible to create good-looking images on VGA cards in the first place.
    – Schmuddi
    Nov 8 at 9:24
  • 2
    @Justme what you described will be (256-16)/7 = ~34 color steps per each RGB combination which would be really better for just dithering in RGB space than what we got but what we got are HSV based color steps instead which much better coincides with human vision so even if mathematicaly RGB distance to dithered colors is bigger it should be less in HSV so visulay more closer ... Its hard to say which app uses default and which custom palette without peeking but to my knowledge majority of pixel art based stuff was custom palette.
    – Spektre
    Nov 8 at 10:02
  • 2
    It might be helpful to include an image or link to what the palette is.
    – dan04
    Nov 8 at 16:47
  • 3
    @Spektre "HSV [...] much better coincides with human vision". HSV is very far from any understanding of human perception of color. Our eyes have sensors sensitive to blue, green and red (well, reddish green and greenish red really), and those signals are converted to a luminosity, a red-green balance, and a blue-yellow balance before they leave the eyes. Nowhere is there a physical representation of hue or saturation involved in our vision. Nov 9 at 21:06

4 Answers 4

93

TL;DR: It's All About How To Look At the Palette

256-color VGA palette

That way it doesn't look any hideous and ugly, or does it?


How Come?

What is the origin of the default 256-color VGA palette?

IBM's BIOS code :))

SCNR. I guess you ask more about the reasoning for it's content and ordering, right? In that case it's about packing as much functionality as possible into a single palette.

Although subjective, I believe I'm not the only one considering default VGA 256 color palette to be hideous and ugly.

Not so sure, it's pretty clean and made to support several items:

  • Providing compatibility with 16 colour modes (*1)
  • Providing a simple gray scale mode
  • Providing a rich colour field that is
    • fit for photo like pictures
    • allowing simple picture manipulation
    • allowing forms of animation
  • Providing (a few) user defined colours not touched by BIOS.

What is the story behind this, why were these particular colors chosen?

IBM describes it on p. 4-39 of the technical reference as

The internal palette of the video subsystem is not used to select colors. It is set by BIOS and should not be changed. The external palette in the video DAC is programmed by the BIOS such that the first 16 locations contain colors that are compatible with colors of other modes. See Figure 4-27 on page 4-40. The second 16 registers contain 16 evenly spaced gray shades. The remaining 216 locations are loaded based on a hue-saturation-intensity model tuned to provide a usable, generic color set that covers a wide range of color values.

This fulfils all 4 requirements:

  • The first 16 colours are encoded exactly as with all 16 colour modes (0Dh/0Eh/10h/12h) which in turn use the same 4 bit encoding as the colour attributes of all text modes (*1).

  • The next 16 deliver an even lit 4 bit black (10h) to white (1Fh) grayscale

  • The remaining code space is used to deliver an evenly spaced, HSV colour cylinder (*2) based on a

    • 24 hue RGB wheel, starting at blue, with 8 subdivisions per R,G and B, resulting in 24 (3x8) discrete "hues". Each of those is present in
    • 3 level of saturation (colourfulness) and further in
    • 3 level of intensity(value of brightness)

    Those 216 (3x8x3x3) colours, together with the 16 base colours and 16 gray scale (=248) leave 8 unused definitions. By guaranteeing that the BIOS will not touch them those

  • 8 colour definitions are guaranteed free for user applications.

Bottom Line: it's all about serving for 4 different needs in a single colour table:

  • A colour palette as natural and evenly spaced (*3) as possible

while still offering

  • 16 base colours ordered compatible
  • binary coded gray scale
  • user definable colours

All of this only looks kind of 'weird' when looking at the table without seeing those 4 purposes and the way the full colour table is structured obeying the prime number 3 embedded thrice to please the RGB colour as well as the available code space.

Of course the usual way of displaying the palette as 16x16 entries isn't helpful either(*4):

enter image description here

(Picture taken from Wikipedia)

Reordering it according to the 16 + 16 + 24x3x3 + 8 structure gives a way better impression(*5):

enter image description here

The four different groups are now clearly visible with the middle part nicely presenting the underlying sequence of

  • 24 hues, going from blue to blue around the circle,

    each provided 9 times to offer a product in

  • 3 level of saturation (colourfulness) and

  • 3 level of brightness

Beside well spread covering of colour space, this 3 by 3 ordering also allows any picture made of those 24 hues can be direct desaturated and/or dimmed by a simple operation:

  • Adding 24/48 reduces saturation, while
  • Adding 72/144 reduces brightness.

Having this ability allows certain styles of picture manipulation as well as animation, like fase in/out from/to black/white.


In conclusion, I would think that combining all of the above requirements into a single palette is quite an achievement.


*1 - Which in turn were selected for compatibility with the CGA/EGA 8+8 RGB-I mode.

*2 - HSV vs. RGB is maybe the most overlooked part when programmers and engineers think or talk about this (and other) palette(s). They start auf from an RGB PoV which describes a technology to create colour by adding three base colours. A quite convenient system from an engineering perspective, as it reduces the problem to 3 values of equal weight. Except, that's not like human vision (or natural colour) works.

It's also not the way picture handling and manipulation works. Tools like Photoshop or Gimp primary handle colour manipulation in HSV categories.

This also touches the issue between image creation and picture handling. Thinking in RGB is fine to do Monkey Island, but not for a photo app. The standard palette tries to please the later as well.

*3 - Please note that uncounted books were written about various colour theories during the last 2000+ years, all in their own right due the complex nature of colour creation and human perception.

RGB as technology driven format does not solve any of that, but rather add another layer of complication (due translation). Of course we can punch ahead and throw enough resources (like a 24+ bit palette) at the problem to seemingly solve. Except, it's not solved, just hidden.

Thus naturally/evenly spaced can not mean numeric equal spacing of RGB values (like 100%, 66% and 33%) as the human perception does not work linear. The selection of RGB values takes that into account by

  • 'lifting' (de)saturation as 0%, 48% and 71% and
  • 'dimming' brightness as 100%, 44% and 29%.

Doing so creates complementary levels for a richer colour space than doing either linear would.

*4 - Three being a prime doesn't go well neither with a decimal nor a binary number system, or does it?

*5 - For another image see here.

32
  • 3
    Even the first block can be divided in two, updated the pics.
    – aybe
    Nov 8 at 2:27
  • 2
    @aybe Thanks for the effort, but that's not the way it is intended. Sure, on CGA it's the RGB+I coding, but that's not the point her - see the cited IBM documentation. Added a footnote for that.
    – Raffzahn
    Nov 8 at 2:34
  • 9
    The color palette isn't very natural, though. If we were to go about it today, we'd map 216 perceptively equidistant points of the color space... trading granularity in desaturated tones for much finer luma resolution. But that's why most everyone had to use a custom palette. Nov 8 at 6:30
  • 8
    I wonder what the rationale was for choosing these particular levels of brightness and of saturation for the three bands (approx. 100%, 50%, and 30%, respectively). The last two levels are very close to each other, and as a result, the overall palette has way too many colors that are perceptually indistinguishable. In other words, while the default palette offered perhaps 48 brightly colored hues, it also had ~96 desaturated dark tones that were extremely hard to tell apart.
    – Schmuddi
    Nov 8 at 9:39
  • 5
    Not sure about the "as natural as possible" claim. For what definition of "natural" is that? Seems more like, someone tried to do at least something non-random. Some engineer's best effort. Nov 8 at 10:54
25

The VGA default palette in the 256 colour mode (Mode 13h) first has 16 color entries from CGA (which is also same as default 16-color EGA palette and the only palette for 320x200 EGA mode)

Next 16 color entries are 16 shades of gray.

And the next 216 color entries has been already mentioned; they are sets of 24 hues, in 3 different saturation values, and in 3 different brightness values. 24 × 3 × 3 = 216.

The final 8 colour entries are black, or maybe left undefined so BIOS does not overwrite them when changing modes.

After doing some further research, about the time when VGA was being designed, real graphics workstations already had better color capabilities and HSV was a bit of a craze because it provides an intuitive color model of picking colors to draw, especially to a non-technical or artist type of person using the computer. In reality HSV is quite unuseful for any other task than colour picking, as said by even highly appreciated video engineer Charles Poynton, while specifically mentioning HSV/HSL being flawed with respect to the properties of color vision.

So my guess is, because HSV was all the craze in colour picking back then, and it is a nice feature to at least initialize the palette by default to some colors instead of filling it with black or left uninitialized, the VGA default palette simply was initialized with something somebody came up, with 24 hues in 3 brightness and in 3 saturation combos to draw pretty rainbows and show off the video capabilities compared to EGA for example.

As there is a lot of repetition at different brightness and saturation levels, a part of the palette can be stored in small array and the different brightness and saturation levels could be calculated, as on VGA ROM there is not much free space left for complex palettes after storing all the necessary code and fonts.

1
  • 4
    Back in the day, I noticed that the last few colors were inconsistent. Maybe they would have been reliably left undisturbed if one ran a program to set them before using an application that didn't, but I wouldn't be at all surprised if some VGA card BIOS routines would clear them on a mode change.
    – supercat
    Nov 7 at 17:28
4

If I recall, it's the 16-color default palette, followed by 216 colors chosen as the combinations of 3 luminance values, 3 saturation values, and 24 hue values. Having 24 hues for all nine combinations of luminance and saturation seems wasteful, but I think the design objective was to allow pretty rainbows at any lightness/saturation combo.

4
  • 1
    I think I forgot some 16-level brightness gradients in gray and RGB, but even with those not all 256 entries were used.
    – supercat
    Nov 7 at 17:24
  • @Supercat, I believe you are misremembering. What you seem to be describing is an HSB (HSV, whatever) color mapping. As far as I know, VGA only supported direct RGB mapping.
    – RichF
    Nov 7 at 19:05
  • 5
    @RichF: The default palette entries were chosen to contain the RGB values corresponding to 216 HSV triplets.
    – supercat
    Nov 7 at 19:48
  • I missed that he was referring to 8-bit VGA, sorry.
    – RichF
    Nov 8 at 4:47
2

People may think of VGA as ugly now, but considering what came before it, it offered much more flexibility than most previous home computer color implementations. Those often offered 8 or 16 colors maximum. When they offered more than that, RAM and memory access time was so expensive that manufacturers reduced screen resolution; 320x200 was a common limit if a computer offered many colors (above 16 and less than or equal to 256 colors total).

That said, original, pure VGA was quite restrictive. (I'm writing about 16-bit VGA, not its backward compatible modes.) Six bits per color component allows for 262,144 total colors. That is far less than healthy human eyes can see. While far in excess of the 256 colors allowed in the GIF image standard, GIF (and 8-bit PNG) has a secret advantage. An image had associated Look Up Tables (LUTs), allowing a given image to access one set of 256 colors from a full 24-bit palette With decent post-processing, a 24-bit image can usually be color-sampled to achieve an "ideal" set of colors for that image. On the other hand, even if a VGA card was advanced enough to offer an 8-bit mapping of each color component, routine software would not (and probably could not with the CPU usually being busy with other stuff than ideal color display) map the 262,144 colors to use the ideal color set from 24-bit digital-to-analog computers.

But from my perspective as someone who lived through evolving home graphics capabilities from the start, VGA was pretty darn good.

For reference, see List of 16-bit computer color palettes

3
  • 7
    I think OP is asking about the default mode13h palette, i.e. the one with all the rainbows at different intensities.
    – mm201
    Nov 7 at 20:41
  • 7
    I think ths answer fails to answer the question, it talks about something else. Yes, VGA has 8-bit pixels and 18-bit color lookup table in the RAMDAC, but why the default palette is what it is?
    – Justme
    Nov 7 at 20:55
  • 1
    @Justme, I misread the question, somehow not realizing that it was limited to a small portion of VGA capabilities.
    – RichF
    Nov 8 at 4:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .