]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Move Monotone button, checkbox styles out of StyleNano and into sheetlets (#41120)
authoreoineoineoin <helloworld@eoinrul.es>
Mon, 27 Oct 2025 20:24:19 +0000 (20:24 +0000)
committerGitHub <noreply@github.com>
Mon, 27 Oct 2025 20:24:19 +0000 (21:24 +0100)
Content.Client/Stylesheets/CommonStylesheet.cs
Content.Client/Stylesheets/SheetletConfigs/IButtonConfig.cs
Content.Client/Stylesheets/Sheetlets/LabelSheetlet.cs
Content.Client/Stylesheets/Sheetlets/MonotoneButtonSheetlet.cs [new file with mode: 0644]
Content.Client/Stylesheets/Sheetlets/MonotoneCheckBoxSheetlet.cs [new file with mode: 0644]
Content.Client/Stylesheets/StyleClass.cs
Content.Client/Stylesheets/StyleNano.cs

index d7634e68ebaf8f35e74435b235d27be387c530c9..f8eae88b38e8225f5b1b6a17245bfa236c9d4923 100644 (file)
@@ -65,6 +65,11 @@ public abstract class CommonStylesheet : PalettedStylesheet, IButtonConfig, IWin
     ResPath IButtonConfig.RoundedButtonPath => new("rounded_button.svg.96dpi.png");
     ResPath IButtonConfig.RoundedButtonBorderedPath => new("rounded_button_bordered.svg.96dpi.png");
 
+    ResPath IButtonConfig.MonotoneBaseButtonPath => new("Monotone/monotone_button.svg.96dpi.png");
+    ResPath IButtonConfig.MonotoneOpenLeftButtonPath => new("Monotone/monotone_button_open_left.svg.96dpi.png");
+    ResPath IButtonConfig.MonotoneOpenRightButtonPath => new("Monotone/monotone_button_open_right.svg.96dpi.png");
+    ResPath IButtonConfig.MonotoneOpenBothButtonPath => new("Monotone/monotone_button_open_both.svg.96dpi.png");
+
     ColorPalette IButtonConfig.ButtonPalette => PrimaryPalette with { PressedElement = PositivePalette.PressedElement };
     ColorPalette IButtonConfig.PositiveButtonPalette => PositivePalette;
     ColorPalette IButtonConfig.NegativeButtonPalette => NegativePalette;
index 3dc8f07ef8ed528d6317d9f9cf1f87eeb8052a42..01155c6e46568c6fac6caaba97f97ea3e0d60cd3 100644 (file)
@@ -12,6 +12,10 @@ public interface IButtonConfig : ISheetletConfig
     public ResPath SmallButtonPath { get; }
     public ResPath RoundedButtonPath { get; }
     public ResPath RoundedButtonBorderedPath { get; }
+    public ResPath MonotoneBaseButtonPath { get; }
+    public ResPath MonotoneOpenLeftButtonPath { get; }
+    public ResPath MonotoneOpenRightButtonPath { get; }
+    public ResPath MonotoneOpenBothButtonPath { get; }
 
     public ColorPalette ButtonPalette { get; }
     public ColorPalette PositiveButtonPalette { get; }
index 9135b53555aae52715a1d0eec16c55c4a8c503d5..77c554a9f36ae7d40999422199128a7271e3d62c 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Client.Resources;
 using Content.Client.Stylesheets.Fonts;
 using Content.Client.Stylesheets.Palette;
 using Robust.Client.UserInterface;
@@ -11,6 +12,10 @@ public sealed class LabelSheetlet : Sheetlet<PalettedStylesheet>
 {
     public override StyleRule[] GetRules(PalettedStylesheet sheet, object config)
     {
+        var robotoMonoBold11 = ResCache.GetFont("/Fonts/RobotoMono/RobotoMono-Bold.ttf", size: 11);
+        var robotoMonoBold12 = ResCache.GetFont("/Fonts/RobotoMono/RobotoMono-Bold.ttf", size: 12);
+        var robotoMonoBold14 = ResCache.GetFont("/Fonts/RobotoMono/RobotoMono-Bold.ttf", size: 14);
+
         return
         [
             E<Label>()
@@ -58,6 +63,17 @@ public sealed class LabelSheetlet : Sheetlet<PalettedStylesheet>
             E<Label>()
                 .Class(StyleClass.StatusCritical)
                 .FontColor(Palettes.Status.Critical),
+
+            // Console text
+            E<Label>()
+                .Class(StyleClass.LabelMonospaceText)
+                .Prop(Label.StylePropertyFont, robotoMonoBold11),
+            E<Label>()
+                .Class(StyleClass.LabelMonospaceHeading)
+                .Prop(Label.StylePropertyFont, robotoMonoBold12),
+            E<Label>()
+                .Class(StyleClass.LabelMonospaceSubHeading)
+                .Prop(Label.StylePropertyFont, robotoMonoBold14),
         ];
     }
 }
diff --git a/Content.Client/Stylesheets/Sheetlets/MonotoneButtonSheetlet.cs b/Content.Client/Stylesheets/Sheetlets/MonotoneButtonSheetlet.cs
new file mode 100644 (file)
index 0000000..9ae2cdc
--- /dev/null
@@ -0,0 +1,105 @@
+using System.Numerics;
+using Content.Client.Stylesheets.Stylesheets;
+using Content.Client.Stylesheets.SheetletConfigs;
+using Content.Client.UserInterface.Controls;
+using Robust.Client.Graphics;
+using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.Controls;
+using static Content.Client.Stylesheets.StylesheetHelpers;
+
+namespace Content.Client.Stylesheets.Sheetlets;
+
+[CommonSheetlet]
+public sealed class MonotoneButtonSheetlet<T> : Sheetlet<T> where T : IButtonConfig
+{
+    public override StyleRule[] GetRules(T sheet, object config)
+    {
+        // Monotone (unfilled)
+        var monotoneButton = new StyleBoxTexture
+        {
+            Texture = sheet.GetTextureOr(sheet.MonotoneBaseButtonPath, NanotrasenStylesheet.TextureRoot)
+        };
+        monotoneButton.SetPatchMargin(StyleBox.Margin.All, 11);
+        monotoneButton.SetPadding(StyleBox.Margin.All, 1);
+        monotoneButton.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
+        monotoneButton.SetContentMarginOverride(StyleBox.Margin.Horizontal, 14);
+
+        var monotoneButtonOpenLeft = new StyleBoxTexture(monotoneButton)
+        {
+            Texture = sheet.GetTextureOr(sheet.MonotoneOpenLeftButtonPath, NanotrasenStylesheet.TextureRoot)
+        };
+
+        var monotoneButtonOpenRight = new StyleBoxTexture(monotoneButton)
+        {
+            Texture = sheet.GetTextureOr(sheet.MonotoneOpenRightButtonPath, NanotrasenStylesheet.TextureRoot)
+        };
+
+        var monotoneButtonOpenBoth = new StyleBoxTexture(monotoneButton)
+        {
+            Texture = sheet.GetTextureOr(sheet.MonotoneOpenBothButtonPath, NanotrasenStylesheet.TextureRoot)
+        };
+
+        // Monotone (filled)
+        var buttonTex = sheet.GetTextureOr(sheet.OpenLeftButtonPath, NanotrasenStylesheet.TextureRoot);
+        var monotoneFilledButton = new StyleBoxTexture(monotoneButton)
+        {
+            Texture = buttonTex
+        };
+
+        var monotoneFilledButtonOpenLeft = new StyleBoxTexture(monotoneButton)
+        {
+            Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(14, 24))),
+        };
+        monotoneFilledButtonOpenLeft.SetPatchMargin(StyleBox.Margin.Left, 0);
+
+        var monotoneFilledButtonOpenRight = new StyleBoxTexture(monotoneButton)
+        {
+            Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(0, 0), new Vector2(14, 24))),
+        };
+        monotoneFilledButtonOpenRight.SetPatchMargin(StyleBox.Margin.Right, 0);
+
+        var monotoneFilledButtonOpenBoth = new StyleBoxTexture(monotoneButton)
+        {
+            Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(3, 24))),
+        };
+        monotoneFilledButtonOpenBoth.SetPatchMargin(StyleBox.Margin.Horizontal, 0);
+
+
+        return
+        [
+            // Unfilled
+            E<MonotoneButton>()
+                .Box(monotoneButton),
+            E<MonotoneButton>()
+                .Class(StyleClass.ButtonOpenLeft)
+                .Box(monotoneButtonOpenLeft),
+            E<MonotoneButton>()
+                .Class(StyleClass.ButtonOpenRight)
+                .Box(monotoneButtonOpenRight),
+            E<MonotoneButton>()
+                .Class(StyleClass.ButtonOpenBoth)
+                .Box(monotoneButtonOpenBoth),
+
+            // Filled
+            E<MonotoneButton>()
+                .PseudoPressed()
+                .Box(monotoneFilledButton)
+                .Prop(Button.StylePropertyModulateSelf, Color.White),
+            E<MonotoneButton>()
+                .Class(StyleClass.ButtonOpenLeft)
+                .PseudoPressed()
+                .Box(monotoneFilledButtonOpenLeft)
+                .Prop(Button.StylePropertyModulateSelf, Color.White),
+            E<MonotoneButton>()
+                .Class(StyleClass.ButtonOpenRight)
+                .PseudoPressed()
+                .Box(monotoneFilledButtonOpenRight)
+                .Prop(Button.StylePropertyModulateSelf, Color.White),
+            E<MonotoneButton>()
+                .Class(StyleClass.ButtonOpenBoth)
+                .PseudoPressed()
+                .Box(monotoneFilledButtonOpenBoth)
+                .Prop(Button.StylePropertyModulateSelf, Color.White),
+        ];
+    }
+}
diff --git a/Content.Client/Stylesheets/Sheetlets/MonotoneCheckBoxSheetlet.cs b/Content.Client/Stylesheets/Sheetlets/MonotoneCheckBoxSheetlet.cs
new file mode 100644 (file)
index 0000000..54ab12b
--- /dev/null
@@ -0,0 +1,30 @@
+using Content.Client.Resources;
+using Content.Client.Stylesheets.SheetletConfigs;
+using Content.Client.UserInterface.Controls;
+using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.Controls;
+using static Content.Client.Stylesheets.StylesheetHelpers;
+
+namespace Content.Client.Stylesheets.Sheetlets;
+
+[CommonSheetlet]
+public sealed class MonotoneCheckBoxSheetlet<T> : Sheetlet<T> where T : PalettedStylesheet, IButtonConfig
+{
+    public override StyleRule[] GetRules(T sheet, object config)
+    {
+        IButtonConfig buttonCfg = sheet;
+
+        var monotoneCheckBoxTextureChecked = ResCache.GetTexture("/Textures/Interface/Nano/Monotone/monotone_checkbox_checked.svg.96dpi.png");
+        var monotoneCheckBoxTextureUnchecked = ResCache.GetTexture("/Textures/Interface/Nano/Monotone/monotone_checkbox_unchecked.svg.96dpi.png");
+
+        return [
+            E<TextureRect>()
+                .Class(MonotoneCheckBox.StyleClassMonotoneCheckBox)
+                .Prop(TextureRect.StylePropertyTexture, monotoneCheckBoxTextureUnchecked),
+            E<TextureRect>()
+                .Class(MonotoneCheckBox.StyleClassMonotoneCheckBox)
+                .Class(CheckBox.StyleClassCheckBoxChecked)
+                .Prop(TextureRect.StylePropertyTexture, monotoneCheckBoxTextureChecked),
+        ];
+    }
+}
index 4a1082751bd619035d5edd9122a061774fd7dca5..39e3ff7d94c053b0a2e6d84f62c0a6c5b304d074 100644 (file)
@@ -40,6 +40,9 @@ public static class StyleClass
     public const string LabelSubText = "LabelSubText";
     public const string LabelKeyText = "LabelKeyText";
     public const string LabelWeak = "LabelWeak"; // replaces `LabelSecondaryColor`
+    public const string LabelMonospaceText = "ConsoleText";
+    public const string LabelMonospaceHeading = "ConsoleText";
+    public const string LabelMonospaceSubHeading = "ConsoleText";
 
     public const string BackgroundPanel = "BackgroundPanel"; // replaces `AngleRect`
     public const string BackgroundPanelOpenLeft = "BackgroundPanelOpenLeft"; // replaces `BackgroundOpenLeft`
index 5c8e86319445787d0ed53dd0b25af3ac5f719e7f..01b666a4b04867b34443920674e6090db7d82399 100644 (file)
@@ -194,9 +194,6 @@ namespace Content.Client.Stylesheets
             var notoSansBold18 = resCache.NotoStack(variation: "Bold", size: 18);
             var notoSansBold20 = resCache.NotoStack(variation: "Bold", size: 20);
             var notoSansMono = resCache.GetFont("/EngineFonts/NotoSans/NotoSansMono-Regular.ttf", size: 12);
-            var robotoMonoBold11 = resCache.GetFont("/Fonts/RobotoMono/RobotoMono-Bold.ttf", size: 11);
-            var robotoMonoBold12 = resCache.GetFont("/Fonts/RobotoMono/RobotoMono-Bold.ttf", size: 12);
-            var robotoMonoBold14 = resCache.GetFont("/Fonts/RobotoMono/RobotoMono-Bold.ttf", size: 14);
 
             var windowHeaderTex = resCache.GetTexture("/Textures/Interface/Nano/window_header.png");
             var windowHeader = new StyleBoxTexture
@@ -425,60 +422,9 @@ namespace Content.Client.Stylesheets
             };
             progressBarForeground.SetContentMarginOverride(StyleBox.Margin.Vertical, 14.5f);
 
-            // Monotone (unfilled)
-            var monotoneButton = new StyleBoxTexture
-            {
-                Texture = resCache.GetTexture("/Textures/Interface/Nano/Monotone/monotone_button.svg.96dpi.png"),
-            };
-            monotoneButton.SetPatchMargin(StyleBox.Margin.All, 11);
-            monotoneButton.SetPadding(StyleBox.Margin.All, 1);
-            monotoneButton.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
-            monotoneButton.SetContentMarginOverride(StyleBox.Margin.Horizontal, 14);
-
-            var monotoneButtonOpenLeft = new StyleBoxTexture(monotoneButton)
-            {
-                Texture = resCache.GetTexture("/Textures/Interface/Nano/Monotone/monotone_button_open_left.svg.96dpi.png"),
-            };
-
-            var monotoneButtonOpenRight = new StyleBoxTexture(monotoneButton)
-            {
-                Texture = resCache.GetTexture("/Textures/Interface/Nano/Monotone/monotone_button_open_right.svg.96dpi.png"),
-            };
-
-            var monotoneButtonOpenBoth = new StyleBoxTexture(monotoneButton)
-            {
-                Texture = resCache.GetTexture("/Textures/Interface/Nano/Monotone/monotone_button_open_both.svg.96dpi.png"),
-            };
-
-            // Monotone (filled)
-            var monotoneFilledButton = new StyleBoxTexture(monotoneButton)
-            {
-                Texture = buttonTex,
-            };
-
-            var monotoneFilledButtonOpenLeft = new StyleBoxTexture(monotoneButton)
-            {
-                Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(14, 24))),
-            };
-            monotoneFilledButtonOpenLeft.SetPatchMargin(StyleBox.Margin.Left, 0);
-
-            var monotoneFilledButtonOpenRight = new StyleBoxTexture(monotoneButton)
-            {
-                Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(0, 0), new Vector2(14, 24))),
-            };
-            monotoneFilledButtonOpenRight.SetPatchMargin(StyleBox.Margin.Right, 0);
-
-            var monotoneFilledButtonOpenBoth = new StyleBoxTexture(monotoneButton)
-            {
-                Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(3, 24))),
-            };
-            monotoneFilledButtonOpenBoth.SetPatchMargin(StyleBox.Margin.Horizontal, 0);
-
             // CheckBox
             var checkBoxTextureChecked = resCache.GetTexture("/Textures/Interface/Nano/checkbox_checked.svg.96dpi.png");
             var checkBoxTextureUnchecked = resCache.GetTexture("/Textures/Interface/Nano/checkbox_unchecked.svg.96dpi.png");
-            var monotoneCheckBoxTextureChecked = resCache.GetTexture("/Textures/Interface/Nano/Monotone/monotone_checkbox_checked.svg.96dpi.png");
-            var monotoneCheckBoxTextureUnchecked = resCache.GetTexture("/Textures/Interface/Nano/Monotone/monotone_checkbox_unchecked.svg.96dpi.png");
 
             // Tooltip box
             var tooltipTexture = resCache.GetTexture("/Textures/Interface/Nano/tooltip.png");
@@ -983,17 +929,6 @@ namespace Content.Client.Stylesheets
                     new StyleProperty(BoxContainer.StylePropertySeparation, 10),
                 }),
 
-                // MonotoneCheckBox
-                new StyleRule(new SelectorElement(typeof(TextureRect), new [] { MonotoneCheckBox.StyleClassMonotoneCheckBox }, null, null), new[]
-                {
-                    new StyleProperty(TextureRect.StylePropertyTexture, monotoneCheckBoxTextureUnchecked),
-                }),
-
-                new StyleRule(new SelectorElement(typeof(TextureRect), new [] { MonotoneCheckBox.StyleClassMonotoneCheckBox, CheckBox.StyleClassCheckBoxChecked }, null, null), new[]
-                {
-                    new StyleProperty(TextureRect.StylePropertyTexture, monotoneCheckBoxTextureChecked),
-                }),
-
                 // Tooltip
                 new StyleRule(new SelectorElement(typeof(Tooltip), null, null, null), new[]
                 {
@@ -1192,22 +1127,6 @@ namespace Content.Client.Stylesheets
                         new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray),
                     }),
 
-                // Console text
-                new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassConsoleText}, null, null), new[]
-                {
-                    new StyleProperty(Label.StylePropertyFont, robotoMonoBold11)
-                }),
-
-                new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassConsoleSubHeading}, null, null), new[]
-                {
-                    new StyleProperty(Label.StylePropertyFont, robotoMonoBold12)
-                }),
-
-                new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassConsoleHeading}, null, null), new[]
-                {
-                    new StyleProperty(Label.StylePropertyFont, robotoMonoBold14)
-                }),
-
                 // Big Button
                 new StyleRule(new SelectorChild(
                     new SelectorElement(typeof(Button), new[] {StyleClassButtonBig}, null, null),
@@ -1286,64 +1205,6 @@ namespace Content.Client.Stylesheets
                         new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorHovered),
                     }),
 
-                // MonotoneButton (unfilled)
-                new StyleRule(
-                    new SelectorElement(typeof(MonotoneButton), null, null, null),
-                    new[]
-                    {
-                        new StyleProperty(Button.StylePropertyStyleBox, monotoneButton),
-                    }),
-
-                new StyleRule(
-                    new SelectorElement(typeof(MonotoneButton), new[] { ButtonOpenLeft }, null, null),
-                    new[]
-                    {
-                        new StyleProperty(Button.StylePropertyStyleBox, monotoneButtonOpenLeft),
-                    }),
-
-                new StyleRule(
-                    new SelectorElement(typeof(MonotoneButton), new[] { ButtonOpenRight }, null, null),
-                    new[]
-                    {
-                        new StyleProperty(Button.StylePropertyStyleBox, monotoneButtonOpenRight),
-                    }),
-
-                new StyleRule(
-                    new SelectorElement(typeof(MonotoneButton), new[] { ButtonOpenBoth }, null, null),
-                    new[]
-                    {
-                        new StyleProperty(Button.StylePropertyStyleBox, monotoneButtonOpenBoth),
-                    }),
-
-                // MonotoneButton (filled)
-                new StyleRule(
-                    new SelectorElement(typeof(MonotoneButton), null, null, new[] { Button.StylePseudoClassPressed }),
-                    new[]
-                    {
-                        new StyleProperty(Button.StylePropertyStyleBox, monotoneFilledButton),
-                    }),
-
-                new StyleRule(
-                    new SelectorElement(typeof(MonotoneButton), new[] { ButtonOpenLeft }, null, new[] { Button.StylePseudoClassPressed }),
-                    new[]
-                    {
-                        new StyleProperty(Button.StylePropertyStyleBox, monotoneFilledButtonOpenLeft),
-                    }),
-
-                new StyleRule(
-                    new SelectorElement(typeof(MonotoneButton), new[] { ButtonOpenRight }, null, new[] { Button.StylePseudoClassPressed }),
-                    new[]
-                    {
-                        new StyleProperty(Button.StylePropertyStyleBox, monotoneFilledButtonOpenRight),
-                    }),
-
-                new StyleRule(
-                    new SelectorElement(typeof(MonotoneButton), new[] { ButtonOpenBoth }, null, new[] { Button.StylePseudoClassPressed }),
-                    new[]
-                    {
-                        new StyleProperty(Button.StylePropertyStyleBox, monotoneFilledButtonOpenBoth),
-                    }),
-
                 // NanoHeading
 
                 new StyleRule(