Is there any simple global way to disable the green text color when a button is focused?
Really, I wouldn’t mind disabling focus features (navigation and visuals) completely, but then text input fields and such which need focus won’t work. I guess I could subclass Button and try disabling focus or focus color in the constructor - any other ways that require fewer code changes before I start looking into that?
It’s not that specific color, I’d rather not have it change color at all. I could try making the focus color the same as the text default, but not sure if it’ll prevent me from overriding the color when I want to show the button “toggled” on.
Almost - that did stop the green, but now it stays yellow (the mouseover color) after being clicked. Can’t disable that one, we gotta have mouseover indicators.
Not precisely sure what you have in mind, maybe this introduces other issues, but this does seem to work for me (with focusColor=null) without breaking focus when focusColor is null.
protected void resetColors() {
boolean colorNotSet = true;
boolean shadowColorNotSet = true;
if (focusOn && highlightOn) {
// Mix them
ColorRGBA color = mix(getHighlightColor(), getFocusColor());
if (color != null) {
super.setColor(color);
colorNotSet = false;
}
ColorRGBA shadow = mix(getHighlightShadowColor(), getFocusShadowColor());
if (shadow != null) {
super.setShadowColor(shadow);
shadowColorNotSet = false;
}
} else if (highlightOn) {
if (getHighlightColor() != null) {
super.setColor(getHighlightColor());
colorNotSet = false;
}
if (getHighlightShadowColor() != null) {
super.setShadowColor(getHighlightShadowColor());
shadowColorNotSet = false;
}
} else if (focusOn) {
if (getFocusColor() != null) {
super.setColor(getFocusColor());
colorNotSet = false;
}
if (getFocusShadowColor() != null) {
super.setShadowColor(getFocusShadowColor());
shadowColorNotSet = false;
}
}
if (colorNotSet) {
// Just the plain color
super.setColor(getColor());
}
if (shadowColorNotSet) {
super.setShadowColor(getShadowColor());
}
}
It’s not exactly what I had in mind but the effect is the same. The only down side is that it allows shadow colors to mix with colors not necessarily intended.
But if it’s working for you then it’s good until I do a fix (soon I hope).
Edit: if you are curious… my fix would have been to change the conditions to include null checks for the main color… but actually I run into a similar shadow color issue that way.