From add711114c75c8a5dfcdc1596596a2e4244321ba Mon Sep 17 00:00:00 2001 From: Paul Ritter Date: Mon, 10 May 2021 19:49:12 +0200 Subject: [PATCH] Colors the chatselector in the chatcolor (#3960) Co-authored-by: Paul --- Content.Client/Chat/ChatBox.cs | 3 ++- Content.Client/Chat/ChatManager.cs | 11 ++--------- Content.Client/Utility/ChatHelper.cs | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 Content.Client/Utility/ChatHelper.cs diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index 4662af80f7..7e2a7d3d19 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -454,6 +454,7 @@ namespace Content.Client.Chat { SelectedChannel = toSelect; _channelSelector.Text = ChannelSelectorName(toSelect); + _channelSelector.Modulate = ChatHelper.ChatColor(toSelect); return true; } // keep current setting diff --git a/Content.Client/Chat/ChatManager.cs b/Content.Client/Chat/ChatManager.cs index 294ec47c6d..2d5b7f749a 100644 --- a/Content.Client/Chat/ChatManager.cs +++ b/Content.Client/Chat/ChatManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Content.Client.Administration; using Content.Client.GameObjects.Components.Observer; using Content.Client.Interfaces.Chat; +using Content.Client.Utility; using Content.Shared.Administration; using Content.Shared.Chat; using Robust.Client.Console; @@ -366,15 +367,7 @@ namespace Content.Client.Chat } else { - color = message.Channel switch - { - ChatChannel.Server => Color.Orange, - ChatChannel.Radio => Color.Green, - ChatChannel.OOC => Color.LightSkyBlue, - ChatChannel.Dead => Color.MediumPurple, - ChatChannel.AdminChat => Color.Red, - _ => color - }; + color = ChatHelper.ChatColor(message.Channel); } if (CurrentChatBox == null) return; diff --git a/Content.Client/Utility/ChatHelper.cs b/Content.Client/Utility/ChatHelper.cs new file mode 100644 index 0000000000..459bf0c2f6 --- /dev/null +++ b/Content.Client/Utility/ChatHelper.cs @@ -0,0 +1,19 @@ +using Content.Shared.Chat; +using Robust.Shared.Maths; + +namespace Content.Client.Utility +{ + public class ChatHelper + { + public static Color ChatColor(ChatChannel channel) => + channel switch + { + ChatChannel.Server => Color.Orange, + ChatChannel.Radio => Color.Green, + ChatChannel.OOC => Color.LightSkyBlue, + ChatChannel.Dead => Color.MediumPurple, + ChatChannel.AdminChat => Color.Red, + _ => Color.DarkGray + }; + } +}