Example usage for android.graphics Color WHITE

List of usage examples for android.graphics Color WHITE

Introduction

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

Prototype

int WHITE

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

Click Source Link

Usage

From source file:Main.java

private static void initPaint() {
    whitePaint.setColor(Color.WHITE);
    whitePaint.setTextSize(20);
}

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 void interweaveListViewBgColor(int position, View v) {
    if (position % 2 == 0) {
        v.setBackgroundColor(Color.WHITE);
    } else {/*from w  w w . j a v  a  2  s . c om*/
        v.setBackgroundColor(Color.LTGRAY);
    }
}

From source file:Main.java

public static CharSequence getError(String msg) {
    int color = Color.WHITE;
    ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(color);
    SpannableStringBuilder string = new SpannableStringBuilder(msg);
    string.setSpan(foregroundColorSpan, 0, msg.length(), 0);
    return string;
}

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  ww w  .  j  a  va 2  s  .  c o m
        return Color.BLACK;
    }
}

From source file:Main.java

public static int getBaseColor(int color) {
    if (isLight(color)) {
        return Color.BLACK;
    }/* ww w  .  jav  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 Paint getScoreColor() {
    Paint paint = new Paint();
    paint.setColor(Color.WHITE);
    paint.setTextSize(80);/*from w ww.ja  v  a 2 s.  co m*/
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setShadowLayer(3, 5, 5, Color.BLACK);
    return paint;
}

From source file:Main.java

public static Paint getGameOverColor() {
    Paint paint = new Paint();
    paint.setColor(Color.WHITE);
    paint.setTextSize(80);//  w w  w .jav a  2  s.  c o m
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setShadowLayer(2, 3, 3, Color.GRAY);
    return paint;
}

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  2s  . c om*/
        return Color.WHITE;
    }

}