diff --git a/src/SharpIDE.Godot/Features/Settings/SettingsWindow.cs b/src/SharpIDE.Godot/Features/Settings/SettingsWindow.cs index 6ef82d0..19524f4 100644 --- a/src/SharpIDE.Godot/Features/Settings/SettingsWindow.cs +++ b/src/SharpIDE.Godot/Features/Settings/SettingsWindow.cs @@ -7,15 +7,22 @@ public partial class SettingsWindow : Window private SpinBox _uiScaleSpinBox = null!; private LineEdit _debuggerFilePathLineEdit = null!; private CheckButton _debuggerUseSharpDbgCheckButton = null!; + private OptionButton _themeOptionButton = null!; + + private Theme _lightTheme = ResourceLoader.Load("uid://epmt8kq6efrs"); + private Theme _darkTheme = ResourceLoader.Load("uid://dc7l6bjhn61i5"); + public override void _Ready() { CloseRequested += Hide; _uiScaleSpinBox = GetNode("%UiScaleSpinBox"); _debuggerFilePathLineEdit = GetNode("%DebuggerFilePathLineEdit"); _debuggerUseSharpDbgCheckButton = GetNode("%DebuggerUseSharpDbgCheckButton"); + _themeOptionButton = GetNode("%ThemeOptionButton"); _uiScaleSpinBox.ValueChanged += OnUiScaleSpinBoxValueChanged; _debuggerFilePathLineEdit.TextChanged += OnDebuggerFilePathChanged; _debuggerUseSharpDbgCheckButton.Toggled += OnDebuggerUseSharpDbgToggled; + _themeOptionButton.ItemSelected += OnThemeItemSelected; AboutToPopup += OnAboutToPopup; } @@ -44,4 +51,18 @@ public partial class SettingsWindow : Window { Singletons.AppState.IdeSettings.DebuggerUseSharpDbg = pressed; } + + private void OnThemeItemSelected(long index) + { + var selectedTheme = _themeOptionButton.GetItemText((int)index); + var rootWindow = GetTree().GetRoot(); + if (selectedTheme is "Light") + { + rootWindow.Theme = _lightTheme; + } + else if (selectedTheme is "Dark") + { + rootWindow.Theme = _darkTheme; + } + } } \ No newline at end of file diff --git a/src/SharpIDE.Godot/Features/Settings/SettingsWindow.tscn b/src/SharpIDE.Godot/Features/Settings/SettingsWindow.tscn index d18329d..9c841ba 100644 --- a/src/SharpIDE.Godot/Features/Settings/SettingsWindow.tscn +++ b/src/SharpIDE.Godot/Features/Settings/SettingsWindow.tscn @@ -125,3 +125,33 @@ text = "Necessary if 'Use SharpDbg' is disabled. Get netcoredbg from" layout_mode = 2 text = "here" uri = "https://github.com/Samsung/netcoredbg/releases" + +[node name="VBoxContainer4" type="VBoxContainer" parent="HSplitContainer/PanelContainer/MarginContainer/VBoxContainer2" unique_id=1649657136] +layout_mode = 2 +theme_override_constants/separation = 2 + +[node name="HBoxContainer2" type="HBoxContainer" parent="HSplitContainer/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer4" unique_id=987671656] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer4/HBoxContainer2" unique_id=1404561371] +layout_mode = 2 +text = "Theme" + +[node name="ThemeOptionButton" type="OptionButton" parent="HSplitContainer/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer4/HBoxContainer2" unique_id=1638166442] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +selected = 0 +item_count = 2 +popup/item_0/text = "Dark" +popup/item_0/id = 0 +popup/item_1/text = "Light" +popup/item_1/id = 1 + +[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer4" unique_id=1201262823] +layout_mode = 2 + +[node name="Label2" type="Label" parent="HSplitContainer/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer4/HBoxContainer" unique_id=2074714339] +layout_mode = 2 +theme_type_variation = &"Gray500Label" +text = "The Light theme is experimental, and may contain visual inconsistencies/glitches"