Skip to content
This repository was archived by the owner on Jan 30, 2024. It is now read-only.

Commit 08e2901

Browse files
committed
added text color customization
1 parent 5caf398 commit 08e2901

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

UIMenuColoredItem.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,36 @@ namespace NativeUI
55
public class UIMenuColoredItem : UIMenuItem
66
{
77
public Color MainColor { get; set; }
8-
public Color HighlighColor { get; set; }
8+
public Color HighlightColor { get; set; }
9+
10+
public Color TextColor { get; set; }
11+
public Color HighlightedTextColor { get; set; }
912

1013
public UIMenuColoredItem(string label, Color color, Color highlightColor) : base(label)
1114
{
1215
MainColor = color;
13-
HighlighColor = highlightColor;
16+
HighlightColor = highlightColor;
17+
18+
TextColor = Color.White;
19+
HighlightedTextColor = Color.Black;
1420

1521
Init();
1622
}
1723

1824
public UIMenuColoredItem(string label, string description, Color color, Color highlightColor) : base(label, description)
1925
{
2026
MainColor = color;
21-
HighlighColor = highlightColor;
27+
HighlightColor = highlightColor;
28+
29+
TextColor = Color.White;
30+
HighlightedTextColor = Color.Black;
2231

2332
Init();
2433
}
2534

2635
protected void Init()
2736
{
28-
_selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38), 0, HighlighColor);
37+
_selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38), 0, HighlightColor);
2938
_rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0));
3039
_text = new UIResText(Text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.Font.ChaletLondon, UIResText.Alignment.Left);
3140
Description = Description;
@@ -49,7 +58,7 @@ public override void Draw()
4958
}
5059
if (Selected)
5160
{
52-
_selectedSprite.Color = HighlighColor;
61+
_selectedSprite.Color = HighlightColor;
5362
_selectedSprite.Draw();
5463
}
5564
else
@@ -58,7 +67,7 @@ public override void Draw()
5867
_selectedSprite.Draw();
5968
}
6069

61-
_text.Color = Enabled ? Selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);
70+
_text.Color = Enabled ? Selected ? HighlightedTextColor : TextColor : Color.FromArgb(163, 159, 148);
6271

6372
if (LeftBadge != BadgeStyle.None)
6473
{
@@ -86,7 +95,7 @@ public override void Draw()
8695
{
8796
_labelText.Position = new Point(420 + Offset.X + Parent.WidthOffset, _labelText.Position.Y);
8897
_labelText.Caption = RightLabel;
89-
_labelText.Color = _text.Color = Enabled ? Selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);
98+
_labelText.Color = _text.Color = Enabled ? Selected ? HighlightedTextColor : TextColor : Color.FromArgb(163, 159, 148);
9099
_labelText.Draw();
91100
}
92101
_text.Draw();

0 commit comments

Comments
 (0)