How to darken a given color (int)

后端 未结 6 2104

I have a function that takes a given color and I would like it to darken the color (reduce its brightness by 20% or so). I can\'t figure out how to do this given just a colo

6条回答
  •  醉酒成梦
    2020-12-29 22:22

    Convert the color to a HSV array, then reduce the brightness by 20%, then convert HSV array back to RGB with HSVToColor. Note: The value you are looking to change in the array will be the V-value. (i.e., hsv[2])

提交回复
热议问题