Java color opacity
•
Java
I have a way to determine the color based on certain values The method is as follows:
public Color color(double val) { double H = val * 0.3; double S = 0.9; double B = 0.9; return Color.getHSBColor((float)H,(float)S,(float)B); }
I also want to make the color transparent How can I do this? thank you
Solution
The simplest way is to specify R, G, B and a directly using the following constructors:
public Color(float r,float g,float b,float a).
I know you have HSB, but you can easily convert to RGB
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码