diff --git a/runelite-client/src/main/java/net/runelite/client/chat/ChatMessageManager.java b/runelite-client/src/main/java/net/runelite/client/chat/ChatMessageManager.java index bc3cfc96e7..3d14b7a5c4 100644 --- a/runelite-client/src/main/java/net/runelite/client/chat/ChatMessageManager.java +++ b/runelite-client/src/main/java/net/runelite/client/chat/ChatMessageManager.java @@ -231,6 +231,7 @@ public class ChatMessageManager case OBJECT_EXAMINE: case NPC_EXAMINE: case CONSOLE: + case FRIENDSCHATNOTIFICATION: return JagexColors.CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND; } } @@ -251,6 +252,7 @@ public class ChatMessageManager case OBJECT_EXAMINE: case NPC_EXAMINE: case CONSOLE: + case FRIENDSCHATNOTIFICATION: return JagexColors.CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND; } } diff --git a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java index 30666249eb..d24d952435 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ChatColorConfig.java @@ -25,7 +25,6 @@ package net.runelite.client.config; import java.awt.Color; -import net.runelite.client.ui.JagexColors; @ConfigGroup("textrecolor") public interface ChatColorConfig extends Config @@ -111,15 +110,12 @@ public interface ChatColorConfig extends Config @ConfigItem( position = 7, - keyName = "opaqueClanChatInfo", + keyName = "opaqueFriendsChatInfo", name = "Friends chat info", description = "Friends Chat Information (eg. when joining a channel)", section = opaqueSection ) - default Color opaqueFriendsChatInfo() - { - return JagexColors.CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND; - } + Color opaqueFriendsChatInfo(); @ConfigItem( position = 8, @@ -387,15 +383,12 @@ public interface ChatColorConfig extends Config @ConfigItem( position = 57, - keyName = "transparentClanChatInfo", + keyName = "transparentFriendsChatInfo", name = "Friends chat info (transparent)", description = "Friends chat information (eg. when joining a channel) (transparent)", section = transparentSection ) - default Color transparentFriendsChatInfo() - { - return JagexColors.CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND; - } + Color transparentFriendsChatInfo(); @ConfigItem( position = 58, diff --git a/runelite-client/src/test/java/net/runelite/client/chat/ChatMessageManagerTest.java b/runelite-client/src/test/java/net/runelite/client/chat/ChatMessageManagerTest.java index 6bdb200694..97b2caaef0 100644 --- a/runelite-client/src/test/java/net/runelite/client/chat/ChatMessageManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/chat/ChatMessageManagerTest.java @@ -145,4 +145,41 @@ public class ChatMessageManagerTest verify(messageNode).setName("" + friendName + ""); } + + @Test + public void testDefaultFriendsChatInfoColors() + { + // no color is configured for opaqueFriendsChatInfo + when(chatColorConfig.opaqueFriendsChatInfoHighlight()).thenReturn(Color.RED); + + // rebuild color cache + ConfigChanged configChanged = new ConfigChanged(); + configChanged.setGroup("textrecolor"); + chatMessageManager.onConfigChanged(configChanged); + + String chatMessage = new ChatMessageBuilder() + .append(ChatColorType.NORMAL) + .append("Total points: ") + .append(ChatColorType.HIGHLIGHT) + .append("42") + .append(ChatColorType.NORMAL) + .append(", Personal points: ") + .append(ChatColorType.HIGHLIGHT) + .append("43") + .append(ChatColorType.NORMAL) + .append(" (") + .append(ChatColorType.HIGHLIGHT) + .append("44") + .append(ChatColorType.NORMAL) + .append("%)") + .build(); + + MessageNode messageNode = mock(MessageNode.class); + when(messageNode.getType()).thenReturn(ChatMessageType.FRIENDSCHATNOTIFICATION); + when(messageNode.getRuneLiteFormatMessage()).thenReturn(chatMessage); + + chatMessageManager.update(messageNode); + + verify(messageNode).setValue("Total points: 42, Personal points: 43 (44%)"); + } } \ No newline at end of file