From 9242f23787db8e290b18de05de8c51c3e6692d5a Mon Sep 17 00:00:00 2001 From: choco Date: Fri, 3 Oct 2025 09:55:54 +0200 Subject: [PATCH] color reset button always shown, but disabled if no custom value --- LightlessSync/UI/SettingsUi.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index e2a218f..ce2b230 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -1022,10 +1022,12 @@ public class SettingsUi : WindowMediatorSubscriberBase // actions column ImGui.TableSetColumnIndex(2); - if (UIColors.IsCustom(colorKey)) + using var resetId = ImRaii.PushId($"Reset_{colorKey}"); + var availableWidth = ImGui.GetContentRegionAvail().X; + var isCustom = UIColors.IsCustom(colorKey); + + using (ImRaii.Disabled(!isCustom)) { - using var resetId = ImRaii.PushId($"Reset_{colorKey}"); - var availableWidth = ImGui.GetContentRegionAvail().X; using (ImRaii.PushFont(UiBuilder.IconFont)) { if (ImGui.Button(FontAwesomeIcon.Undo.ToIconString(), new Vector2(availableWidth, 0))) @@ -1033,8 +1035,8 @@ public class SettingsUi : WindowMediatorSubscriberBase UIColors.Reset(colorKey); } } - UiSharedService.AttachToolTip("Reset this color to default"); } + UiSharedService.AttachToolTip(isCustom ? "Reset this color to default" : "Color is already at default value"); } ImGui.EndTable();