]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add a sheetlet for ConfirmButton (#41011)
authoreoineoineoin <helloworld@eoinrul.es>
Tue, 21 Oct 2025 22:23:52 +0000 (23:23 +0100)
committerGitHub <noreply@github.com>
Tue, 21 Oct 2025 22:23:52 +0000 (22:23 +0000)
* Add a sheetlet for ConfirmButton

* Move sheetlet to central location; alphabetize using statements

Content.Client/Stylesheets/Sheetlets/ConfirmButtonSheetlet.cs [new file with mode: 0644]
Content.Client/Stylesheets/StyleNano.cs

diff --git a/Content.Client/Stylesheets/Sheetlets/ConfirmButtonSheetlet.cs b/Content.Client/Stylesheets/Sheetlets/ConfirmButtonSheetlet.cs
new file mode 100644 (file)
index 0000000..45f8521
--- /dev/null
@@ -0,0 +1,32 @@
+using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.Controls;
+using Content.Client.Stylesheets;
+using Content.Client.Stylesheets.Stylesheets;
+using static Content.Client.Stylesheets.StylesheetHelpers;
+
+namespace Content.Client.UserInterface.Controls;
+
+[CommonSheetlet]
+public sealed class ConfirmButtonSheetlet : Sheetlet<NanotrasenStylesheet>
+{
+    public override StyleRule[] GetRules(NanotrasenStylesheet sheet, object config)
+    {
+        return [
+            E<ConfirmButton>()
+                .Pseudo(ConfirmButton.ConfirmPrefix + ContainerButton.StylePseudoClassNormal)
+                .Prop(Control.StylePropertyModulateSelf, sheet.NegativePalette.Element),
+
+            E<ConfirmButton>()
+                .Pseudo(ConfirmButton.ConfirmPrefix + ContainerButton.StylePseudoClassHover)
+                .Prop(Control.StylePropertyModulateSelf, sheet.NegativePalette.HoveredElement),
+
+            E<ConfirmButton>()
+                .Pseudo(ConfirmButton.ConfirmPrefix + ContainerButton.StylePseudoClassPressed)
+                .Prop(Control.StylePropertyModulateSelf, sheet.NegativePalette.PressedElement),
+
+            E<ConfirmButton>()
+                .Pseudo(ConfirmButton.ConfirmPrefix + ContainerButton.StylePseudoClassDisabled)
+                .Prop(Control.StylePropertyModulateSelf, sheet.NegativePalette.DisabledElement),
+        ];
+    }
+}
index 573b83cca4dfca782362a1602a0c4245a84625b6..b1c20d1814cb36c7ae998acdd33176f10bc2c46c 100644 (file)
@@ -740,23 +740,6 @@ namespace Content.Client.Stylesheets
                     .Pseudo(ContainerButton.StylePseudoClassDisabled)
                     .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionDisabled),
 
-                // Colors for confirm buttons confirm states.
-                Element<ConfirmButton>()
-                    .Pseudo(ConfirmButton.ConfirmPrefix + ContainerButton.StylePseudoClassNormal)
-                    .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionDefault),
-
-                Element<ConfirmButton>()
-                    .Pseudo(ConfirmButton.ConfirmPrefix + ContainerButton.StylePseudoClassHover)
-                    .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionHovered),
-
-                Element<ConfirmButton>()
-                    .Pseudo(ConfirmButton.ConfirmPrefix + ContainerButton.StylePseudoClassPressed)
-                    .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionPressed),
-
-                Element<ConfirmButton>()
-                    .Pseudo(ConfirmButton.ConfirmPrefix + ContainerButton.StylePseudoClassDisabled)
-                    .Prop(Control.StylePropertyModulateSelf, ButtonColorCautionDisabled),
-
                 new StyleRule(new SelectorChild(
                     new SelectorElement(typeof(Button), null, null, new[] {ContainerButton.StylePseudoClassDisabled}),
                     new SelectorElement(typeof(Label), null, null, null)),