darken Color - Android android.graphics

Android examples for android.graphics:Color

Description

darken Color

Demo Code

import android.graphics.Color;
import android.support.annotation.ColorInt;

public class Main {

  @ColorInt// w  ww.  j  a  v a2 s.  c  om
  public static int darkenColor(@ColorInt int color) {
    float[] hsv = new float[3];
    Color.colorToHSV(color, hsv);
    hsv[2] *= 0.8f; // value component
    color = Color.HSVToColor(hsv);
    return color;
  }

}

Related Tutorials