Example usage for android.graphics Color rgb

List of usage examples for android.graphics Color rgb

Introduction

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

Prototype

@ColorInt
public static int rgb(float red, float green, float blue) 

Source Link

Document

Return a color-int from red, green, blue float components in the range \([0..1]\).

Usage

From source file:Main.java

public static Color getRandomColor() {
    Color color = new Color();
    color.rgb(getRandomNum(255), getRandomNum(255), getRandomNum(255));
    // setBackgroundColor(Color.rgb(getRandomNum(255),getRandomNum(255),getRandomNum(255)))
    return color;
}

From source file:Main.java

protected static int get64(int i) {
    return Color.rgb(i % 4 * 85, i / 4 % 4 * 85, i / 16 % 4 * 85);
}

From source file:Main.java

public static int lightenColor(int color) {
    return Color.rgb(Math.min(Color.red(color) + 50, 255), Math.min(Color.green(color) + 50, 255),
            Math.min(Color.blue(color) + 50, 255));
}

From source file:Main.java

public static int borderColorForBackground(int color) {
    return Color.rgb(Math.max(0, Color.red(color) - 30), Math.max(0, Color.green(color) - 30),
            Math.max(0, Color.blue(color) - 30));
}

From source file:Main.java

public static int converToDecimalFromHex(String s) {
    return Color.rgb(cH(s.substring(1, 3)), cH(s.substring(3, 5)), cH(s.substring(5, 7)));
}

From source file:Main.java

public static int getColor(int index) {
    int colors[] = new int[] { Color.rgb(69, 228, 106), Color.rgb(228, 96, 69), Color.rgb(80, 125, 209),
            Color.rgb(230, 249, 88) };
    return colors[index];
}

From source file:Main.java

public static int rgb(int r, int g, int b) {
    return Color.rgb(r, g, b);
    /* volume color//from  ww  w . java 2  s  .  c  om
    if (r == 0 && g == 0 && b == 0)
       return Color.BLACK;
    float mult = 1 + (amplitude / 10000f);
    int newR = Math.min(255, (int)Math.round(r * mult));
    int newG = Math.min(255, (int)Math.round(g * mult));
    int newB = Math.min(255, (int)Math.round(b * mult));
    return Color.rgb(newR, newG, newB);
     */
}

From source file:Main.java

public static int toColor(int r, int g, int b) {

    return Color.rgb(r, g, b);

}

From source file:Main.java

public static int gteRandomColor() {
    Random random = new Random();
    return Color.rgb(random.nextInt(200) + 20, random.nextInt(200) + 20, random.nextInt(200) + 20);
}

From source file:Main.java

public static int getRandomColor() {
    return Color.rgb(random.nextInt(256), random.nextInt(256), random.nextInt(256));
}