AuthorTopic: What is best 256 color palette?  (Read 11033 times)

Offline Piotr

  • 0001
  • *
  • Posts: 69
  • Karma: +0/-1
  • I love 80-column texts
    • View Profile
    • google.pl

What is best 256 color palette?

on: September 01, 2015, 02:54:55 pm
I want to know what is best 256-color palette. Not all entries have to be occupied.
I know these:
* Subset of 10-10-10 level RGB (1000 colors). First 125 colors are combinations of 5 levels of RGB each with LSB off. Next 125 are same, but with LSB on. For total of 250 colors, 6 remain.
* Subset of 16-16-16 level RGB (4096 colors). The format is IIRRGGBB: R, G and B are two most significant bits of each component, while I sets 2 LSBs of each component.
* Another IIRRGGBB format palette, but I sets color brightness to 25, 50, 75 or 100 percent of original. There is more fidelity in darker colors, but there is some redundancy: blacks, and 66% red with 50% brightness is same as 33% red with 100% brightness.
* 256-level grayscale for full brightness fidelity but no color/saturation fidelity at all. Variant: 128-level grayscale and fill remaining 128 colors to compensate for human's limited vision (human sees 21-bit RGB, not 24-bit).
* Level combination: each of 4-16-4, 8-8-4, 6-6-6, 6-7-6, 6-8-5, 7-7-5, 5-9-5, 5-10-5 and others for RGB are accepted.
* As above, but for hue, saturation, value/light. NES tried this.
* 2 bits for red/blue, 3 bits for green. Other bit is LSB of red and blue.
* Make four cubes of 64 colors, where there are 4 RGB levels in each cube chosen from 8 levels. Example: 0-2-5-7, 0-1-2-3, 2-3-4-5, 4-5-6-7. Configurator link: http://drag.wootest.net/misc/8bit_rgb.html
* To reduce large RGB bit-based palette by 2 bits, merge LSB of red, green and blue to one bit, as long as they all exist. If there are only two normal components with their own bits, you can only merge them to compress by 1 bit. This preserves all grays of palette (only if there are equal bits of each component), but reduces hue/saturation fidelity.

Here are samples for some of them:
Uniform HSV selection: There are 15 hues, 2 saturations, 9 values in full saturation, 7 values in half saturation, 17 grays and some transparency.

Uniform RGB selection: There are 4 bits for each component, where 2 least significant bits are shared between components. As a result, there are 2 bits for each component and 2 least significant bits shared between components. There are 18 hues, 2 saturations and 16 values. Best case precision is 12 bits, while worst case precision is 6 bits.
Format: RRGGBBSS
In other words, it's 4 RGB cubes, where each RGB component can be any of following values:
  • 0, 68, 136, 204
  • 17, 85, 153, 221
  • 34, 102, 170, 238
  • 51, 119, 187, 255
Example: 255, 119, 51 (orange)
« Last Edit: September 30, 2015, 03:23:31 pm by Piotr »

Offline Gil

  • 0100
  • ***
  • Posts: 1540
  • Karma: +1/-0
  • Too square to be hip
    • http://pixeljoint.com/p/475.htm
    • View Profile
    • My Portfolio

Re: What is best 256 color palette?

Reply #1 on: September 02, 2015, 12:31:24 am
Wouldn't the best palette be a hand-picked one? 256 is way more colors than you'd ever need I feel. A unified 32 or 64 color palette should be plenty to do an entire game in.

Offline Streaksy

  • 0001
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #2 on: September 02, 2015, 02:41:09 am
I've tried several algorithms to populate a palette, and there's no universally perfect way.  Evenly distributed RGB over 256 colours can make some things look pretty good and other things ugly.  It depends what it's for.  If you can't predict it's use like you were building a games system, then, yeah, you'd probably generate something that covers the RGB combination range in as many steps as you can based on palette size.

Then there's hand-picking colours and maybe adding them as needed.

The old default VGA palette was based on being organised rather than universal...

Or.. if it's for a game... something I've done a few times to reduce filesizes... make the art largely in 24bit without colour constraints, put all the artwork in one image canvas and reduce the colours to 8 bit / 256 colours, and see what you have.  That's just technical, though.  It doesn't really answer your question of a single perfect palette.  ;/  If you really must work with 256 colours for some reason but want freedom of design, that's probably the way.

Offline Piotr

  • 0001
  • *
  • Posts: 69
  • Karma: +0/-1
  • I love 80-column texts
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #3 on: September 02, 2015, 11:20:53 am
I've tried several algorithms to populate a palette, and there's no universally perfect way.  Evenly distributed RGB over 256 colours can make some things look pretty good and other things ugly.  It depends what it's for.  If you can't predict it's use like you were building a games system, then, yeah, you'd probably generate something that covers the RGB combination range in as many steps as you can based on palette size.

Then there's hand-picking colours and maybe adding them as needed.

The old default VGA palette was based on being organised rather than universal...

Or.. if it's for a game... something I've done a few times to reduce filesizes... make the art largely in 24bit without colour constraints, put all the artwork in one image canvas and reduce the colours to 8 bit / 256 colours, and see what you have.  That's just technical, though.  It doesn't really answer your question of a single perfect palette.  ;/  If you really must work with 256 colours for some reason but want freedom of design, that's probably the way.
It does not matter it looks ugly in some objects. I just want to know the best one, not actually doing art (if art, then only for testing the palette)

Offline yrizoud

  • 0010
  • *
  • Posts: 240
  • Karma: +0/-0
    • View Profile

Re: What is best 256 color palette?

Reply #4 on: September 02, 2015, 12:49:46 pm
If there was a best one, there would be no reason to use any other palette, right ?

In general, if you're striving to "compute" a versatile palette, you should rather try split the HSV / HSL spaces than the RGB cube. There are some very large areas of these cubes where you don't need a lot of detail, but they are more easy to describe/define/compute according to HSL : Ex. "the more saturation increases, the more hue is important" and "as the color approaches maximum and minimum lightness, hue and saturation become irrelevant"

(human sees 21-bit RGB, not 24-bit)
Where did you hear that ?

Offline Cyangmou

  • Moderator
  • 0011
  • *
  • Posts: 912
  • Karma: +3/-0
    • cyangmou
    • http://pixeljoint.com/p/32234.htm
    • cyangmou
    • View Profile
    • Pixwerk Homepage

Re: What is best 256 color palette?

Reply #5 on: September 02, 2015, 01:36:08 pm
Wouldn't the best palette be a hand-picked one? 256 is way more colors than you'd ever need I feel. A unified 32 or 64 color palette should be plenty to do an entire game in.

yeah I agree, handpicked palettes are the best.

Would say 256 is easy to exceed without caring about color limits. Games like modern castlevania etc. exceed that.
However palettes have more to do with contrasts and color intensity. You can't evenly distribute them because the numbers on the scales don't match up with the human impression of color (red always looks stronger than blue)

An unified also palette has it's pros and cons.
While an unfied palette allows you to produce quite fast it gets really hard with capturing exact light effects, which greatly can liven up your art in terms of mood and atmosphere.
And color is anyways an balancing act. THere are no ugly colors,just ugly combinations of them.

picking/choosing your own colors will learn you how colors exactly work in the long run. That's quite an interesting journey.
"Because the beauty of the human body is that it hasn't a single muscle which doesn't serve its purpose; that there's not a line wasted; that every detail of it fits one idea, the idea of a man and the life of a man."

Dev-Art
Twitter

Offline Piotr

  • 0001
  • *
  • Posts: 69
  • Karma: +0/-1
  • I love 80-column texts
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #6 on: September 02, 2015, 03:34:51 pm
If there was a best one, there would be no reason to use any other palette, right ?

In general, if you're striving to "compute" a versatile palette, you should rather try split the HSV / HSL spaces than the RGB cube. There are some very large areas of these cubes where you don't need a lot of detail, but they are more easy to describe/define/compute according to HSL : Ex. "the more saturation increases, the more hue is important" and "as the color approaches maximum and minimum lightness, hue and saturation become irrelevant"


I know about using HSL/HSV spaces instead. Anyway, thanks for a hint!

Quote from: Piotr
* Level combination: each of 4-16-4, 8-8-4, 6-6-6, 6-7-6, 6-8-5, 7-7-5, 5-9-5 and others for RGB are accepted.
* As above, but for hue, saturation, value/light. NES tried this.

YIQ color space may give best results.

Offline Gil

  • 0100
  • ***
  • Posts: 1540
  • Karma: +1/-0
  • Too square to be hip
    • http://pixeljoint.com/p/475.htm
    • View Profile
    • My Portfolio

Re: What is best 256 color palette?

Reply #7 on: September 02, 2015, 07:08:23 pm
I personally would do what Arne did. Get a bunch of reference images, calculate a palette out of that, sorted by which colors show up most. Maybe write a program that collects all palette entries for an image, throw in a bunch of classic pixel art, then use an algorithm to reduce to 256 colors?

Offline Ai

  • 0100
  • ***
  • Posts: 1071
  • Karma: +2/-0
  • finti
    • View Profile

Re: What is best 256 color palette?

Reply #8 on: September 03, 2015, 11:21:23 am
I've tried it. My results with K-means clustering of LAB or LCH colorspaces were 'best', but still not all that satisfactory.

Currently, HUSL seems like the best colorspace for attempting to programmatically derive a palette from. HSY is simpler but also less well optimized (in terms of maximizing difference between colors), though it is better than HSL.

I've tried YIQ and YCbCr, IMO they are better than RGB but otherwise fairly unremarkable.

I recommend entirely ignoring HSV: it is possibly the worst colorspace I've encountered in terms of providing meaningful measures of difference between colors.

Finally, if you're going to do what Gil suggests, keep in mind the algorithm you use for reduction. Most palette reducers use some kind of median cut, which generally reduces contrast by minimizing extreme values, so consider increasing contrast before reduction, to compensate.
« Last Edit: September 03, 2015, 11:27:11 am by Ai »
Obviously minimalism isn't everything -- but regarding learning art, yeah, it is pretty much everything.

Confidence is an attitude, not a feeling. Directed failure is the engine of confidence.

Offline Piotr

  • 0001
  • *
  • Posts: 69
  • Karma: +0/-1
  • I love 80-column texts
    • View Profile
    • google.pl

Re: What is best 256 color palette?

Reply #9 on: September 03, 2015, 04:49:29 pm
I've tried YIQ and YCbCr, IMO they are better than RGB but otherwise fairly unremarkable.
My reason for using YIQ rather than YUV or YCbCr is that bounds of YIQ mean that eye is less sensitive to Q than I, so it's compressed more which allows to increase overall. For YUV, U and V would require about same values as Y to achieve similar color fidelity (same for YCbCr).