I've found this piece of code:
public static boolean colorWillBeMasked(int color, Application app){
if(android.R.color.transparent == color) return true; int[] rgb = {Color.red(color), Color.green(color), Color.blue(color)}; int brightness =
(int)Math.sqrt(
rgb[0] * rgb[0] * .241 +
rgb[1] * rgb[1] * .691 +
rgb[2] * rgb[2] * .068);System.out.println("COLOR: " + color + ", BRIGHT: " + brightness);//note 0,black 1,classic 2int theme = app.api.getThemeView();// color is darkif(brightness <= 40){
if(theme == 1) return true;}
// color is lightelse if (brightness >= 215){
if(theme == 2) return true;}
return false;}
Which gives true of false based on the color masking of the int color and the background of the app. That is not what I want, I want to compare two int colors with each other.
How can I check that?
If possible with custom range (or tolerance)
Thank you in advance,
Tim
public static boolean colorWillBeMasked(int color, Application app){
if(android.R.color.transparent == color) return true; int[] rgb = {Color.red(color), Color.green(color), Color.blue(color)}; int brightness =
(int)Math.sqrt(
rgb[0] * rgb[0] * .241 +
rgb[1] * rgb[1] * .691 +
rgb[2] * rgb[2] * .068);System.out.println("COLOR: " + color + ", BRIGHT: " + brightness);//note 0,black 1,classic 2int theme = app.api.getThemeView();// color is darkif(brightness <= 40){
if(theme == 1) return true;}
// color is lightelse if (brightness >= 215){
if(theme == 2) return true;}
return false;}
Which gives true of false based on the color masking of the int color and the background of the app. That is not what I want, I want to compare two int colors with each other.
How can I check that?
If possible with custom range (or tolerance)
Thank you in advance,
Tim