Is there a way to check if a color is close to another color ?
For example whether a color ( say #D4FFA9
) is close of being green?
something like :
boolean areColorsClose(int colorOne, int colorTwo) {}
Is there a way to check if a color is close to another color ?
For example whether a color ( say #D4FFA9
) is close of being green?
something like :
boolean areColorsClose(int colorOne, int colorTwo) {}
You could subtract one from the other, such as:
int color1 = 0x7fffff;
int color2 = 0x000123;
int color_difference = color1 - color2;
Then decide what you consider 'close to each other':
if (color_difference <= [your acceptable difference]){
// Colors are close.
}else //Colors are too different.
Both of these colors are a shade of green: 0x08ff76 and 0x04b252
Their difference is: 44d24
if (color_difference <= 44d24){
// Colors are close.
}else //Colors are too different.
You would need to decide what you consider close first :)