package util;
import java.awt.Color;
public class ColorUtil {
public static Color blueColor = Color.decode("#3399FF");
public static Color grayColor = Color.decode("#999999");
public static Color backgroundColor = Color.decode("#eeeeee");
public static Color warningColor = Color.decode("#FF3333");
//根据b百分比显示不同的颜色
public static Color getByPercentage(int per) {
if (per > 100)
per = 100;
int r = 51;
int g = 255;
int b = 51;
float rate = per / 100f;
r = (int) ((255 - 51) * rate + 51);//百分比为0时,r为51;百分比为1时,r为255;
g = 255 - r + 51;//百分比为0时,g为255;百分比为1时,g为51;
Color color = new Color(r, g, b);
return color;
}
}