Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to divide rgb color palette?

I'm trying to generate a color palette which has 16 colors. i will display this palette in 4x4 grid.

so i have to find a way to rgb color palette which has 255*255*255 colors divided to 16 colors equally and logically.

i think it's gonna be a mathematical algorithm. because i'm tring to pick 16 vectors from 3x3 matrix which picked in equal scale.

like image 908
Mehmet Fatih Yıldız Avatar asked Sep 04 '10 22:09

Mehmet Fatih Yıldız


2 Answers

actually i have found a way depends on this "dividing color palette" problem. i will use this color values with converting rgb values to hsv values.

hue, saturation, value

so i can use one integer value between 0-360 or i can use one integer between 0-100 (%) for my color palette.

finally, i can easily use this values for searhing/filtering my data based on color selection. i'm diving 0-360 range to 16 pices equally, so i can easily define 16 different colors.

but thanks for different approaches

like image 147
Mehmet Fatih Yıldız Avatar answered Oct 07 '22 10:10

Mehmet Fatih Yıldız


You are basically projecting a cube (R X G X B) onto a square (4 X 4). First, I would start by asking myself what size cube fits inside that square.

1 X 1 X 1 =  1
2 X 2 X 2 =  8
3 X 3 X 3 = 27

The largest cube that fits in the square has 8 colors. At that point, I would note how conveniently 8 is an integral factor of 16.

I think the convenience would tempt me to use 8 basic colors in 2 variants like light and dark or saturated and unsaturated.

like image 39
bbadour Avatar answered Oct 07 '22 12:10

bbadour