Colors the chatselector in the chatcolor (#3960)

Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
This commit is contained in:
Paul Ritter
2021-05-10 19:49:12 +02:00
committed by GitHub
parent 7330ed5087
commit add711114c
3 changed files with 23 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
@@ -454,6 +454,7 @@ namespace Content.Client.Chat
{ {
SelectedChannel = toSelect; SelectedChannel = toSelect;
_channelSelector.Text = ChannelSelectorName(toSelect); _channelSelector.Text = ChannelSelectorName(toSelect);
_channelSelector.Modulate = ChatHelper.ChatColor(toSelect);
return true; return true;
} }
// keep current setting // keep current setting

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Content.Client.Administration; using Content.Client.Administration;
using Content.Client.GameObjects.Components.Observer; using Content.Client.GameObjects.Components.Observer;
using Content.Client.Interfaces.Chat; using Content.Client.Interfaces.Chat;
using Content.Client.Utility;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Chat; using Content.Shared.Chat;
using Robust.Client.Console; using Robust.Client.Console;
@@ -366,15 +367,7 @@ namespace Content.Client.Chat
} }
else else
{ {
color = message.Channel switch color = ChatHelper.ChatColor(message.Channel);
{
ChatChannel.Server => Color.Orange,
ChatChannel.Radio => Color.Green,
ChatChannel.OOC => Color.LightSkyBlue,
ChatChannel.Dead => Color.MediumPurple,
ChatChannel.AdminChat => Color.Red,
_ => color
};
} }
if (CurrentChatBox == null) return; if (CurrentChatBox == null) return;

View File

@@ -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
};
}
}