Last active
September 11, 2018 04:37
-
-
Save brucetoo/8446ca4e46a7d1277904a9f6bbdc0cc3 to your computer and use it in GitHub Desktop.
颜色变淡和变量的处理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* H 色相 就是指颜色 | |
* S 饱和度 0 - 1取值 | |
* V 亮度 0 - 1 | |
* / | |
private static int darkenColor(int color) { | |
float[] hsv = new float[3]; | |
Color.colorToHSV(color, hsv); | |
hsv[2] *= 0.9f; | |
return Color.HSVToColor(hsv); | |
} | |
private static int lightenColor(int color) { | |
float[] hsv = new float[3]; | |
Color.colorToHSV(color, hsv); | |
hsv[2] *= 1.1f; | |
return Color.HSVToColor(hsv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment