@@ -93,6 +93,8 @@ func _ready() -> void:
9393 _settings_dialog .canvas_color_changed .connect (_on_canvas_color_changed )
9494 _settings_dialog .constant_pressure_changed .connect (_on_constant_pressure_changed )
9595
96+ Settings .changed_theme .connect (_on_theme_changed )
97+
9698 # Initialize scale
9799 _on_scale_changed ()
98100
@@ -106,6 +108,11 @@ func _ready() -> void:
106108
107109 # Apply state from previous session
108110 _apply_state ()
111+
112+ # Set theme
113+ var themeIndex = Settings .get_value (Settings .APPEARANCE_THEME , Config .DEFAULT_APPEARANCE_THEME )
114+ var themeName : String = Types .UIThemeArray [themeIndex ]
115+ Settings .changed_theme .emit (themeName )
109116
110117# -------------------------------------------------------------------------------------------------
111118func _notification (what : int ) -> void :
@@ -607,3 +614,25 @@ func _get_general_ui_scale() -> float:
607614 elif smallest_dimension >= 1700 :
608615 return Config .DEFAULT_UI_SCALE * 1.5
609616 return Config .DEFAULT_UI_SCALE
617+
618+ # --------------------------------------------------------------------------------------------------
619+ func _on_theme_changed (path : String ) -> void :
620+ var themePath : String = str ("res://UI/Themes/" , path , "/theme.tres" )
621+ var toolBarPath : String = str ("res://UI/Themes/" , path , "/toolbar.tres" )
622+ print (themePath )
623+ var theme : Theme = load (themePath )
624+ var toolbarTheme : StyleBoxFlat = load (toolBarPath )
625+ set_theme (theme )
626+ _toolbar .set_theme (theme )
627+ _toolbar .add_theme_stylebox_override ("panel" , toolbarTheme )
628+ _toolbar .queue_redraw ()
629+ _statusbar .set_theme (theme )
630+ _statusbar .queue_redraw ()
631+ _menubar .set_theme (theme )
632+ _menubar .queue_redraw ()
633+ _main_menu .set_theme (theme )
634+ print (_settings_dialog )
635+ _settings_dialog .set_theme (theme )
636+ _settings_dialog .queue_redraw ()
637+ queue_redraw ()
638+ print (theme )
0 commit comments