mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* Nuked StyleNano + Added colors to sheetlet SubjectButtonColors table to define colors (same hex as the ones in StyleNano) SubjectColorRules to loop rules for applying colors * Capitalize every single phrase CONSISTENCY RAHH
115 lines
4.5 KiB
C#
115 lines
4.5 KiB
C#
using Content.Client.Stylesheets;
|
|
using Content.Client.Stylesheets.Sheetlets;
|
|
using Content.Client.Stylesheets.SheetletConfigs;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using static Content.Client.Stylesheets.StylesheetHelpers;
|
|
|
|
namespace Content.Client._DV.AACTablet.UI;
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
[CommonSheetlet]
|
|
public sealed class AACSheetlet<T> : Sheetlet<T> where T : PalettedStylesheet, IButtonConfig
|
|
{
|
|
private static readonly (string StyleClass, Color Normal, Color Hover)[] SubjectButtonColors =
|
|
[
|
|
// Department colors
|
|
("CommandButton", Color.FromHex("#404A58"), Color.FromHex("#4F587B")),
|
|
("EngineeringButton", Color.FromHex("#77684B"), Color.FromHex("#776D71")),
|
|
("EpistemicsButton", Color.FromHex("#6F5973"), Color.FromHex("#71638E")),
|
|
("JusticeButton", Color.FromHex("#4F3D4C"), Color.FromHex("#5C4B5A")),
|
|
("LogisticsButton", Color.FromHex("#61503A"), Color.FromHex("#675C64")),
|
|
("MedicalButton", Color.FromHex("#49687D"), Color.FromHex("#556E95")),
|
|
("SecurityButton", Color.FromHex("#724449"), Color.FromHex("#745370")),
|
|
("ServiceButton", Color.FromHex("#607952"), Color.FromHex("#667A76")),
|
|
];
|
|
|
|
public override StyleRule[] GetRules(T sheet, object config)
|
|
{
|
|
// Create style boxes
|
|
var controlBarBox = new StyleBoxFlat { BackgroundColor = Color.FromHex("#2a2a35") };
|
|
var contentAreaBox = new StyleBoxFlat { BackgroundColor = Color.FromHex("#25252a") };
|
|
var bufferDisplayBox = new StyleBoxFlat { BackgroundColor = Color.FromHex("#1a1a20") };
|
|
bufferDisplayBox.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8);
|
|
bufferDisplayBox.SetContentMarginOverride(StyleBox.Margin.Vertical, 4);
|
|
|
|
var searchBarBox = new StyleBoxFlat { BackgroundColor = Color.FromHex("#2a2a35") };
|
|
|
|
var transparentInputBox = new StyleBoxFlat
|
|
{
|
|
BackgroundColor = Color.Transparent,
|
|
ContentMarginLeftOverride = 4,
|
|
ContentMarginRightOverride = 4
|
|
};
|
|
|
|
var rules = new List<StyleRule>
|
|
{
|
|
// AAC - Control Bar Background
|
|
E<PanelContainer>()
|
|
.Class("AacControlBar")
|
|
.Panel(controlBarBox),
|
|
|
|
// AAC - Content Area Background
|
|
E<PanelContainer>()
|
|
.Class("AacContentArea")
|
|
.Panel(contentAreaBox),
|
|
|
|
// AAC - Buffer Display (where combined phrases show)
|
|
E<PanelContainer>()
|
|
.Class("AacBufferDisplay")
|
|
.Panel(bufferDisplayBox),
|
|
|
|
// AAC - Search Bar
|
|
E<PanelContainer>()
|
|
.Class("AacSearchBar")
|
|
.Panel(searchBarBox),
|
|
|
|
// AAC - Buffer Text Style
|
|
E<LineEdit>()
|
|
.Class("AacBufferText")
|
|
.Prop(LineEdit.StylePropertyStyleBox, transparentInputBox),
|
|
|
|
// AAC - Search Input Style
|
|
E<LineEdit>()
|
|
.Class("AacSearchInput")
|
|
.Prop(LineEdit.StylePropertyStyleBox, transparentInputBox),
|
|
|
|
// AAC - Footer Text
|
|
E<Label>()
|
|
.Class("AacFooterText")
|
|
.Font(sheet.BaseFont.GetFont(10))
|
|
.FontColor(Color.FromHex("#757575")),
|
|
};
|
|
|
|
// Set the base button stylebox for AAC buttons
|
|
rules.AddRange([
|
|
E<ContainerButton>()
|
|
.Class(ContainerButton.StyleClassButton)
|
|
.Class("SendButton")
|
|
.Box(StyleBoxHelpers.BaseStyleBox(sheet)),
|
|
E<ContainerButton>()
|
|
.Class(ContainerButton.StyleClassButton)
|
|
.Class("ClearButton")
|
|
.Prop(Control.StylePropertyModulateSelf, Color.DarkRed),
|
|
]);
|
|
|
|
SubjectColorRules(rules);
|
|
|
|
return rules.ToArray();
|
|
}
|
|
// AAC - Makes sure colors are applied to subject buttons
|
|
private static void SubjectColorRules(List<StyleRule> rules)
|
|
{
|
|
foreach (var (styleClass, normal, hover) in SubjectButtonColors)
|
|
{
|
|
rules.AddRange([
|
|
E<ContainerButton>().Class(ContainerButton.StyleClassButton).Class(styleClass)
|
|
.PseudoNormal().Prop(Control.StylePropertyModulateSelf, normal),
|
|
E<ContainerButton>().Class(ContainerButton.StyleClassButton).Class(styleClass)
|
|
.PseudoHovered().Prop(Control.StylePropertyModulateSelf, hover),
|
|
]);
|
|
}
|
|
}
|
|
}
|