Easy_xkcd
Easy_xkcd copied to clipboard
In night-mode image background is black
trafficstars
Huge shout-out for having night-mode, as well as the AMOLED on/off option.
When using night-mode and AMOLED off the image colors are inverted and it stands out, instead of seamlessly blending with the background. Can we have a variant of the ColorMatrixColorFilter so the image blends nicely?
Thanks
Tbh I copied that filter from stackoverflow, so I have no idea how to adjust it in such a way.. :D You can have a try of course, if you want?
From a quick search - the materials dark is 0x171717, so something like the following should work. I don't have the Android toolchain atm, so it's completely untested.
public ColorFilter getNegativeColorFilter() {
# make these arrays const and/or final?
float[] colorMatrix_amoledNegative = {
-1.0f, 0, 0, 0, 255, //red
0, -1.0f, 0, 0, 255, //green
0, 0, -1.0f, 0, 255, //blue
0, 0, 0, 1.0f, 0 //alpha
};
# Don't hard-code the 0.9 below...
# getColor(... R.color.background_material_dark) - A single color value in the form 0xAARRGGBB.
# For each RGB value, divide by 255, negate and substitute below
float[] colorMatrix_Negative = {
-0.9f, 0, 0, 0, 255, //red
0, -0.9f, 0, 0, 255, //green
0, 0, -0.9f, 0, 255, //blue
0, 0, 0, 1.0f, 0 //alpha
};
return new ColorMatrixColorFilter(amoledThemeEnabled() ? colorMatrix_amoledNegative : colorMatrix_Negative);