Henrik Sommerland
Henrik Sommerland

Reputation: 597

Fading with limited colors

How do you make a nice fade from white to black with a limited set of colors?

I'm writing a "demo" for virtual machine i have designed and written. It has 4096 colors and i need to do a nice fade from white to black. Since there is only 16 different levels of gray i would like to extend this by using some more colors.

I have seen nice fades from white to black on the c64 using far fewer colors.

Is there any general function for doing this in arbitrary color spaces.?

Upvotes: 1

Views: 50

Answers (1)

Emond
Emond

Reputation: 50672

You could calculate the brightness of the available colors:

RGB: brightness = (R + G + B) / 3

Or use other color models (HSL, HSV etc.): http://en.wikipedia.org/wiki/HSV_color_space#Lightness

and order the colors by brightness.

If you are free to generate any color, create/generate a nice palette of colors and, again, order by brightness.

Upvotes: 1

Related Questions