darker a color : Color « 2D Graphics « Android






darker a color

  
import android.graphics.Color;

class Main {

  public static int darker(int c) {
       
        int r = Color.red(c);
        int b = Color.blue(c);
        int g = Color.green(c);

        return Color.rgb((int)(r*.7), (int)(g*.7), (int)(b*.7));
    }
}

   
    
  








Related examples in the same category

1.Using solid color to paint
2.Set color for Paint
3.Create Color from RGB value
4.Load Color from resource xml file
5.Using View to display color
6.Change check box color
7.Color Filters
8.Color Matrix Sample
9.HSV To Color
10.RGB To Color
11.lighten Color
12.Get Random Location and Colors
13.Returns the complimentary (opposite) color.
14.brighter a color
15.extends View to create ColorCircle
16.Increase Red
17.Increase Contrast, Reduce Brightness
18.Decrease Saturation