Source:
<code>private void appendMessage(ChatMessage chatMessage) { String timeString = timeService.asShortTime(chatMessage.getTime()); PlayerInfoBean playerInfoBean = playerService.getPlayerForUsername(chatMessage.getUsername()); try (Reader reader = new InputStreamReader(MESSAGE_ITEM_HTML_RESOURCE.getInputStream())) { String login = chatMessage.getUsername(); String html = CharStreams.toString(reader); String avatarUrl = ""; String clanTag = ""; if (playerInfoBean != null) { avatarUrl = playerInfoBean.getAvatarUrl(); if (StringUtils.isNotEmpty(playerInfoBean.getClan())) { clanTag = i18n.get("chat.clanTagFormat", playerInfoBean.getClan()); } } String text = htmlEscaper().escape(chatMessage.getMessage()).replace("\\", "\\\\"); text = convertUrlsToHyperlinks(text); if (mentionPattern.matcher(text).find()) { text = highlightOwnUsername(text); if (!hasFocus()) { audioController.playChatMentionSound(); } } html = html.replace("{time}", timeString) .replace("{avatar}", StringUtils.defaultString(avatarUrl)) .replace("{username}", login) .replace("{clan-tag}", clanTag) .replace("{text}", text); Collection<String> cssClasses = new ArrayList<>(); if (userToCssStyle.containsKey(login)) { <START> cssClasses.add(userToCssStyle.get(login).toString()); <END> } if (chatMessage.isAction()) { cssClasses.add(ACTION_CSS_CLASS); } else { cssClasses.add(MESSAGE_CSS_CLASS); } PlayerInfoBean playerInfo = playerService.getPlayerForUsername(chatMessage.getUsername()); assignPlayerColor(cssClasses, playerInfo); html = html.replace("{css-classes}", Joiner.on(' ').join(cssClasses)); addToMessageContainer(html); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>cssClasses contains CSS style names, mix colors</technical_language>

Target:
private void appendMessage(ChatMessage chatMessage) { PlayerInfoBean playerInfoBean = playerService.getPlayerForUsername(chatMessage.getUsername()); try (Reader reader = new InputStreamReader(MESSAGE_ITEM_HTML_RESOURCE.getInputStream())) { String login = chatMessage.getUsername(); String html = CharStreams.toString(reader); String avatarUrl = ""; String clanTag = ""; if (playerInfoBean != null) { avatarUrl = playerInfoBean.getAvatarUrl(); if (StringUtils.isNotEmpty(playerInfoBean.getClan())) { clanTag = i18n.get("chat.clanTagFormat", playerInfoBean.getClan()); } } String text = htmlEscaper().escape(chatMessage.getMessage()).replace("\\", "\\\\"); text = convertUrlsToHyperlinks(text); if (mentionPattern.matcher(text).find()) { text = highlightOwnUsername(text); if (!hasFocus()) { audioController.playChatMentionSound(); } } String timeString = timeService.asShortTime(chatMessage.getTime()); html = html.replace("{time}", timeString) .replace("{avatar}", StringUtils.defaultString(avatarUrl)) .replace("{username}", login) .replace("{clan-tag}", clanTag) .replace("{text}", text); Collection<String> cssClasses = new ArrayList<>(); cssClasses.add(String.format("user-%s", chatMessage.getUsername())); if (chatMessage.isAction()) { cssClasses.add(ACTION_CSS_CLASS); } else { cssClasses.add(MESSAGE_CSS_CLASS); } String messageColorClass = getMessageCssClass(login); if (messageColorClass != null) { cssClasses.add(messageColorClass); } html = html.replace("{css-classes}", Joiner.on(' ').join(cssClasses)); html = html.replace("{inline-style}", getInlineStyle(login, messageColorClass)); addToMessageContainer(html); } catch (IOException e) { throw new RuntimeException(e); } }