Converting a number to a greyscale color in Java
Posted
by Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2010-05-06T11:05:39Z
Indexed on
2010/05/06
11:08 UTC
Read the original article
Hit count: 376
Hi,
I'm trying to figure out how I can convert a number between 1 and 50 to a greyscale color that could be used here:
g.setColor(MyGreyScaleColour);
1 would be lightest (white) and 50 would be darkest (black).
e.g.
Color intToCol(int colNum)
{
code here
}
Any suggestions?
© Stack Overflow or respective owner