Skip to content

Instantly share code, notes, and snippets.

@brucetoo
Last active September 11, 2018 04:37
Show Gist options
  • Save brucetoo/8446ca4e46a7d1277904a9f6bbdc0cc3 to your computer and use it in GitHub Desktop.
Save brucetoo/8446ca4e46a7d1277904a9f6bbdc0cc3 to your computer and use it in GitHub Desktop.
颜色变淡和变量的处理
/**
* 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