I use the following class to get colors outside the predefined ones, it should be able to fit your case I belive.
To understand how it works, it is simply that RGBA colors are encoded in a single integer, where each set of 2 bytes store a single color.
2 bytes can encode the values 0-255.Which is the reason that RGB is defined in that range.
public class GuiHelper {
private GuiHelper() {
}
public static int RGBAToInt(int R, int G, int B, int A) {
// Make sure the values are between 0 and 255
R &= 255;
G &= 255;
B &= 255;
A &= 255;
// Convert
return A << 24 | R << 16 | G << 8 | B;
}
public static int RGBAToInt(int RGB, int A) {
return RGBAToInt(RGB, RGB, RGB, A);
}
public static int RGBAToInt(int RGB) {
return RGBAToInt(RGB, RGB, RGB, 255);
}
public static int RGBAToInt(int R, int G, int B) {
return RGBAToInt(R, G, B, 255);
}
}