extends LineEdit


func _enter_tree() -> void:
    ProjectSettings.connect('settings_changed', apply_colors)


func apply_colors():
    var is_light: bool = ProjectSettings.get_setting("application/config/Цвет темы программы", false)
    var style = get_theme_stylebox("normal").duplicate()
    var style_1 = get_theme_stylebox("read_only").duplicate()
    if is_light:
        style.bg_color = Color.GRAY
        style_1.bg_color = Color.GRAY
        add_theme_color_override("font_color", Color.BLACK)
        add_theme_color_override("font_uneditable_color", Color.BLACK)
    else:
        style.bg_color = Color(0.12, 0.12, 0.12)
        style_1.bg_color = Color(0.12, 0.12, 0.12)
        add_theme_color_override("font_color", Color(1.0, 0.596, 0.4))
        add_theme_color_override("font_uneditable_color", Color(1.0, 0.596, 0.4))
    add_theme_stylebox_override("normal", style)
    add_theme_stylebox_override("read_only", style_1)
