How to darken a given color (int)
问题 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 color (int). What is the proper approach? public static int returnDarkerColor(int color){ int darkerColor = .... return darkerColor; } 回答1: A more Android way of doing it: public static int manipulateColor(int color, float factor) { int a = Color.alpha(color); int r = Math.round(Color.red(color) * factor); int g = Math.round