color reset button always shown, but disabled if no custom value

This commit is contained in:
choco
2025-10-03 09:55:54 +02:00
parent e8a3d87ff0
commit 9242f23787

View File

@@ -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 (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();