java - How to determine color shades on the basis of double value? -
i have arraylist double values, these values write out table. color (one color - e.g. green or red) each row on basis of double value, higher value have darker shades , vice versa. maybe can change lightness - correct method?
you can make function creates color based on double value. this:
color getcolor(double val, double min, double max) { int red = 100; int green = 100; int blue = val/(max-min) * 256; return new color (red, green, blue); }
you can change base color moving blue computation other color. or make different equation altogether. idea remains same.
Comments
Post a Comment