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
This way you can select percentage of color and thus fetch a shade darker or a shade lighter
int color = ((ColorDrawable)c2.getBackground()).getColor();
int colorLighter = color - color * 40/100;
int colorDarker = color + color * 40/100;
colorlighter gives us a lighter shade of color from button's background colordarker gives us a darker shade of color from button's background