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:
Wolf Clément
2020-12-19 14:42:20 +01:00
committed by GitHub
parent 805e33e766
commit fea52faa66
6 changed files with 48 additions and 0 deletions
+21
View File
@@ -64,9 +64,30 @@ void ChannelChatters::addPartedUser(const QString &user)
});
}
}
void ChannelChatters::setChatters(UsernameSet &&set)
{
*this->chatters_.access() = set;
}
const QColor ChannelChatters::getUserColor(const QString &user)
{
const auto chatterColors = this->chatterColors_.access();
const auto search = chatterColors->find(user.toLower());
if (search == chatterColors->end())
{
// Returns an invalid color so we can decide not to override `textColor`
return QColor();
}
return search->second;
}
void ChannelChatters::setUserColor(const QString &user, const QColor &color)
{
const auto chatterColors = this->chatterColors_.access();
chatterColors->insert_or_assign(user.toLower(), color);
}
} // namespace chatterino