Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

In this page you can find the example usage for android.graphics Color BLACK.

Prototype

int BLACK

To view the source code for android.graphics Color BLACK.

Click Source Link

Usage

From source file:Main.java

public static int darken(final int color, float fraction) {
    return blendColors(Color.BLACK, color, fraction);
}

From source file:Main.java

public static int getBaseColor(int color) {
    if (isLight(color)) {
        return Color.BLACK;
    }//from ww  w .  j a  v  a  2 s  .  com
    return Color.WHITE;
}

From source file:Main.java

public static int getBrightnessBasedForeground(int color) {
    return isDarkBackground(color) ? Color.WHITE : Color.BLACK;
}

From source file:Main.java

public static int getBorW(int color) {
    int avg = ((Color.red(color) + Color.green(color) + Color.blue(color)) / 3);
    if (avg >= 100) {
        return Color.BLACK;
    } else {/*from w  w w . j a v  a  2  s  .c  om*/
        return Color.WHITE;
    }

}

From source file:Main.java

public static int getContrastColor(int color) {
    double y = (299 * Color.red(color) + 587 * Color.green(color) + 114 * Color.blue(color)) / 1000;
    return y >= 128 ? Color.BLACK : Color.WHITE;
}

From source file:Main.java

public static int colorForString(String color) {
    if (color == null) {
        return (Color.BLACK);
    }/* w w w  .j a  va2 s  .c o  m*/
    String c = color.toLowerCase();
    if (c.equals("red")) {
        return (Color.argb(150, 255, 0, 0));
    } else if (c.equals("yellow")) {
        //         return(Color.YELLOW);
        return (Color.argb(200, 255, 180, 0));
    } else if (c.equals("green")) {
        return (Color.GREEN);
    } else if (c.equals("blue")) {
        return (Color.BLUE);
    } else if (c.equals("purple")) {
        return (Color.argb(255, 255, 0, 255));
    } else if (c.equals("clear")) {
        return (Color.WHITE);
    } else {
        return (Color.BLACK);
    }
}

From source file:Main.java

public static int getHighlightColorFromBitmap(final Bitmap bitmap) {
    int incolor = Color.BLACK;
    if (null != bitmap) {
        final Bitmap bitmap1px = Bitmap.createScaledBitmap(bitmap, 1, 1, false);
        incolor = bitmap1px.getPixel(0, 0);
    }/*from w w w  .j  ava2s.co  m*/
    return getHighlightColor(incolor);
}

From source file:Main.java

public final static int getCategoryDefaultFG(String category) {
    switch (category) {
    case "boardingPass":
        return Color.BLACK;

    case "eventTicket":
        return Color.BLACK;

    case "coupon":
        return Color.BLACK;

    case "storeCard":
        return Color.BLACK;

    case "generic":
        return Color.BLACK;

    default:/*  w  w  w.  j  a  va  2s .  c  o m*/
        return Color.BLACK;
    }

}

From source file:Main.java

public static int textColorForBackground(int background) {
    if (Color.red(background) + Color.green(background) + Color.blue(background) < 383) {
        return Color.WHITE;
    } else {//from  w w w .  j  a  v  a  2 s  .  co  m
        return Color.BLACK;
    }
}

From source file:Main.java

public static int getScrimColor(int background) {
    double a = getLuminance(background);
    if ((int) (a * 100) <= 50) // it was so close...
        return Color.BLACK;
    else//from  www .  j  ava2s.  c  om
        return Color.WHITE;
}