List of usage examples for android.graphics Color rgb
@ColorInt public static int rgb(float red, float green, float blue)
From source file:Main.java
public static String getRandomColor() { Random rand = new Random(); Integer randomColor = Color.rgb(rand.nextInt(), rand.nextInt(), rand.nextInt()); return randomColor.toString(); }
From source file:Main.java
public static int rgbToColor(int[] rgb) { assert (rgb.length == 3); return Color.rgb(rgb[0], rgb[1], rgb[2]); }
From source file:Main.java
public static int oppositeOpacityColor(int color) { int[] rgba = colorToRGBA(color ^ 0xFFFFFFFF); return Color.rgb(rgba[0], rgba[1], rgba[2]); }
From source file:Main.java
public static int getIntFromRGB(JSONObject rgb) { int color = 0; try {//from w w w .java 2 s . co m color = Color.rgb(rgb.getInt("red"), rgb.getInt("green"), rgb.getInt("blue")); } catch (JSONException e) { e.printStackTrace(); } return color; }
From source file:Main.java
public static int getColor(String color) { int[] icolors = getArgbValue(color); int icolor = Color.rgb(0, 0, 0); if (icolors.length == 3) { icolor = Color.rgb(icolors[0], icolors[1], icolors[2]); } else if (icolors.length == 4) { icolor = Color.argb(icolors[0], icolors[1], icolors[2], icolors[3]); } else {/*from w w w . j a va 2s .c om*/ icolor = Color.parseColor(color); } return icolor; }
From source file:Main.java
public static int changeColor(int color, float multiplier) { int red = Color.red(color); int blue = Color.blue(color); int green = Color.green(color); return Color.rgb((int) (red * multiplier), (int) (green * multiplier), (int) (blue * multiplier)); }
From source file:Main.java
public static int getRandomColor() { int red = (int) (Math.random() * 255); int green = (int) (Math.random() * 255); int blue = (int) (Math.random() * 255); return Color.rgb(red, green, blue); }
From source file:Main.java
public static int RGBToColor(final float pRed, final float pGreen, final float pBlue) { return Color.rgb((int) (pRed * COLOR_FLOAT_TO_INT_FACTOR), (int) (pGreen * COLOR_FLOAT_TO_INT_FACTOR), (int) (pBlue * COLOR_FLOAT_TO_INT_FACTOR)); }
From source file:Main.java
public static int getColor(int color) { int r = color >> 16; color -= (r & 0xFF) << 16; int g = color >> 8; color -= (g & 0xFF) << 8;//from ww w. ja v a 2s . c o m int b = color; return Color.rgb(r, g, b); }
From source file:Main.java
public static int randomColor() { Random r = new Random(); int red = r.nextInt(256); int green = r.nextInt(256); int blue = r.nextInt(256); return Color.rgb(red, green, blue); }