[gd_scene load_steps=8 format=3 uid="uid://dgidt8lifm7xe"]

[ext_resource type="Shader" uid="uid://bw5mmbgeycwua" path="res://shaders/color-invers.gdshader" id="2_wrw87"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_f4oye"]

[sub_resource type="GDScript" id="GDScript_kvru5"]
script/source = "extends LineEdit

static var styles: = [null, null]
static var init_done: = false

var checkbutton_material: Material


func _init() -> void:
    if not init_done:
        init_done = true
        var style_light: = get_theme_stylebox('read_only')
        style_light.bg_color =  Color.GRAY
        styles[1] = style_light
        var style_dark: = style_light.duplicate(true)
        style_dark.bg_color = Color(0.12, 0.12, 0.12)
        styles[0] = style_dark
    ProjectSettings.connect('settings_changed', on_setting_changed)
    call_deferred('on_setting_changed')


func on_setting_changed():
    checkbutton_material = $CheckButton.material
    apply_colors()


func apply_colors():
    if ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false):
        add_theme_stylebox_override('read_only', styles[1])
        $CheckButton.material = null
    else:
        add_theme_stylebox_override('read_only', styles[0])
        $CheckButton.material = checkbutton_material
"

[sub_resource type="ShaderMaterial" id="ShaderMaterial_wrw87"]
shader = ExtResource("2_wrw87")

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_t3fqw"]

[sub_resource type="Theme" id="Theme_odxqp"]
CheckButton/styles/focus = SubResource("StyleBoxEmpty_t3fqw")

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_kvru5"]

[node name="LineEdit" type="LineEdit"]
offset_right = 85.0
offset_bottom = 27.0
theme_override_styles/focus = SubResource("StyleBoxEmpty_f4oye")
editable = false
script = SubResource("GDScript_kvru5")

[node name="CheckButton" type="CheckButton" parent="."]
material = SubResource("ShaderMaterial_wrw87")
layout_mode = 0
offset_left = 21.0
offset_top = 1.0
offset_right = 65.0
offset_bottom = 25.0
theme = SubResource("Theme_odxqp")
theme_override_styles/focus = SubResource("StyleBoxEmpty_kvru5")
