darker Color - Android Graphics

Android examples for Graphics:Color Darken

Description

darker Color

Demo Code


//package com.java2s;
import android.graphics.Color;

public class Main {
    private static float colorDiff = 0.18f;

    public static int darkerColor(int color) {
        return changeColor(color, 1f - colorDiff);
    }//  w  w  w  . j  a  v a2  s  .c om

    public static int changeColor(int color, float multiplier) {
        int red = Color.red(color);
        int blue = Color.blue(color);
        int green = Color.green(color);

        return Color.rgb((int) (red * multiplier),
                (int) (green * multiplier), (int) (blue * multiplier));
    }
}

Related Tutorials