How can I use the HSL colorspace in Java?

前端 未结 6 1068
遇见更好的自我
遇见更好的自我 2021-02-12 22:51

I\'ve had a look at the ColorSpace class, and found the constant TYPE_HLS (which presumably is just HSL in a different order).

Can I use this const

6条回答
  •  不思量自难忘°
    2021-02-12 23:35

    EDIT: I realize HSB != HSL, the answer below is for HSB.

    I don't think there is any need to use ColorSpaces here. Try something like the following:

    float hue = 0.9f; //hue
    float saturation = 1.0f; //saturation
    float brightness = 0.8f; //brightness
    
    Color myRGBColor = Color.getHSBColor(hue, saturation, brightness);
    

提交回复
热议问题