Java – how do I adjust the hue of a color code?
•
Java
Maybe someone knows that one method in Java (Android) is to apply hue to color code?
For example, if I have #1589ff and apply 180 hue, I should get #ff8b14
Solution
This should be done:
Color c = new Color(0x15,0x89,0xFF); // Get saturation and brightness. float[] hsbVals = new float[3]; Color.RGBtoHSB(c.getRed(),c.getGreen(),c.getBlue(),hsbVals); // Pass .5 (= 180 degrees) as HUE c = new Color(Color.HSBtoRGB(0.5f,hsbVals[1],hsbVals[2]));
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
二维码