java - What color blending algorithm is used to darken a color? -


i have these cards have 2 color shades on them. main color, , darker accent color:

the main color given me in hex, not accent. can tell kind of blend or transformation being done argb of main color darker accent color?

if matters, i'm developing against android i've got access color class , colorfilter can apply porterduff stuff...

enter image description here

if want darker color, can:

  1. convert rgb hsv rgbtohsv().
  2. reduce v (lightness value). it's hsv[2], float value 0 1.
  3. convert hsv color hsvtocolor().

if want darker bitmap, porterduff.mode.darken should work. need calibrate color value:

private bitmap getdarkerbitmap(bitmap src) {     final int color = 0xaaffffff;     final int width = src.getwidth();     final int height = src.getheight();     final bitmap result = bitmap.createbitmap(width, height, src.getconfig());      final bitmapdrawable drawable = new bitmapdrawable(src);     drawable.setbounds(0, 0, width, height);     drawable.setcolorfilter(color, porterduff.mode.darken);     drawable.draw(new canvas(result));      return result; } 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -