is Color Dark - Android Graphics

Android examples for Graphics:Color

Description

is Color Dark

Demo Code


//package com.java2s;

import android.graphics.Color;

public class Main {
    private static final int BRIGHTNESS_THRESHOLD = 130;

    public static final boolean isColorDark(final int color) {
        return (30 * Color.red(color) + 59 * Color.green(color) + 11 * Color
                .blue(color)) / 100 <= BRIGHTNESS_THRESHOLD;
    }/*from  w w w  .ja  v  a 2s . co  m*/
}

Related Tutorials