online multiplayer chess game (note server currently down)
Diffstat (limited to 'ui/colorpicker/HexInput.gd')
-rw-r--r--ui/colorpicker/HexInput.gd17
1 files changed, 17 insertions, 0 deletions
diff --git a/ui/colorpicker/HexInput.gd b/ui/colorpicker/HexInput.gd
new file mode 100644
index 0000000..6447923
--- /dev/null
+++ b/ui/colorpicker/HexInput.gd
@@ -0,0 +1,17 @@
+extends LineEdit
+class_name HexInput
+
+var color: Color setget set_color
+
+signal color_changed(color)
+
+func set_color(newcolor):
+ color = newcolor
+ var pos = caret_position
+ text = "#" + color.to_html(false)
+ caret_position = pos # make it in the right place
+
+
+func _text_entered(new_text: String):
+ set_color(Color(new_text))
+ emit_signal("color_changed", color)