remove hex field limitations in the responder
this is done through setting max length/the tick method anyway. also fixes an issue where the hex field could not be completely empty
@@ -113,16 +113,13 @@ public class ColorChooser extends Screen implements GuiEventListener, Narratable
gBox.setResponder(boxResponder.apply(gBox));
bBox.setResponder(boxResponder.apply(bBox));
rgbHexBox.setResponder(string -> {
- if (string.length() <= 0)
- string = rgbHexBox.value = "000000";
- else if (string.length() > 6)
- string = rgbHexBox.value = string.substring(0, 6);
-
+ if (!string.isEmpty()) {
int hexColor = Integer.parseInt(string, 16);
updateHSBValues(hexColor >> 16 & 255, hexColor >> 8 & 255, hexColor & 255);
updateTextFields(rgbHexBox);
onColorChange();
+ }
});
}
