Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.graphics.Color;

public class Main {
    public static int darker(int color, float amount) {
        float diff = 255 * amount;
        int r = (int) Math.max(0, (Color.red(color) - diff));
        int b = (int) Math.max(0, (Color.blue(color) - diff));
        int g = (int) Math.max(0, (Color.green(color) - diff));
        return Color.argb(Color.alpha(color), r, g, b);
    }
}