Friday 27 September 2013

Generating Colors from int

Generating Colors from int

I need to create colors depending on 1 int value. For example
void setColor(int x){
red = 2*x;
blue = 5*X;
green = 1*x;
}
The problem is that i cant use random numbers because i want an id to
refer to 1 color(can be more, because i dont really need each color to be
unique)
Basicly i have an array 2d(up to 100 x 100 size), and each field has an id
numered in order from 1, and i would like to keep them a bit separated, so
i would like to make some colors depending on each field id. I dont need
an unique color for each field but i want nearest fields to be in
different colors.
any suggestions? thx
EDIT so i have array and each field has an ID
[1][2][3][4][5]..............
.............................
[1000][1001][10002]..........
and i wanted to make each cell refering to a color based on its ID, for
example ID1 = red ID2 = blue ID3= purple ID1000 = white and so on.

No comments:

Post a Comment