Color mentions to match the mentioned users color (#2284)
You can disable this by unchecking "Color @usernames" under `Settings -> General -> Advanced (misc.)` Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -480,6 +480,16 @@ void TwitchMessageBuilder::addTextOrEmoji(const QString &string_)
|
||||
{
|
||||
QString username = match.captured(1);
|
||||
|
||||
if (getSettings()->colorUsernames)
|
||||
{
|
||||
if (auto userColor =
|
||||
this->twitchChannel->getUserColor(username);
|
||||
userColor.isValid())
|
||||
{
|
||||
textColor = userColor;
|
||||
}
|
||||
}
|
||||
|
||||
this->emplace<TextElement>(string, MessageElementFlag::BoldUsername,
|
||||
textColor, FontStyle::ChatMediumBold)
|
||||
->setLink({Link::UserInfo, username});
|
||||
@@ -499,6 +509,16 @@ void TwitchMessageBuilder::addTextOrEmoji(const QString &string_)
|
||||
|
||||
if (match.hasMatch() && chatters->contains(username))
|
||||
{
|
||||
if (getSettings()->colorUsernames)
|
||||
{
|
||||
if (auto userColor =
|
||||
this->twitchChannel->getUserColor(username);
|
||||
userColor.isValid())
|
||||
{
|
||||
textColor = userColor;
|
||||
}
|
||||
}
|
||||
|
||||
this->emplace<TextElement>(string, MessageElementFlag::BoldUsername,
|
||||
textColor, FontStyle::ChatMediumBold)
|
||||
->setLink({Link::UserInfo, username});
|
||||
@@ -580,6 +600,7 @@ void TwitchMessageBuilder::parseUsername()
|
||||
// }
|
||||
|
||||
this->message().loginName = this->userName;
|
||||
this->twitchChannel->setUserColor(this->userName, this->usernameColor_);
|
||||
|
||||
// Update current user color if this is our message
|
||||
auto currentUser = getApp()->accounts->twitch.getCurrent();
|
||||
|
||||
Reference in New Issue
Block a user