Fixed color button title color

This commit is contained in:
M66B 2020-02-20 17:15:32 +01:00
parent d4e3134c67
commit 32fd65fbb7
1 changed files with 6 additions and 2 deletions

View File

@ -70,8 +70,12 @@ public class ViewButtonColor extends AppCompatButton {
Helper.resolveColor(getContext(), R.attr.colorSeparator)); Helper.resolveColor(getContext(), R.attr.colorSeparator));
setBackground(background); setBackground(background);
double lum = ColorUtils.calculateLuminance(color); if (color == Color.TRANSPARENT)
setTextColor(lum < 0.5 ? Color.WHITE : Color.BLACK); setTextColor(Helper.resolveColor(getContext(), android.R.attr.textColorPrimary));
else {
double lum = ColorUtils.calculateLuminance(color);
setTextColor(lum < 0.5 ? Color.WHITE : Color.BLACK);
}
} }
int getColor() { int getColor() {