diff -r 11598e7aa7e6 -r 7a94005874c9 QTfrontend/chatwidget.cpp --- a/QTfrontend/chatwidget.cpp Tue Feb 01 06:06:38 2011 +0100 +++ b/QTfrontend/chatwidget.cpp Tue Feb 01 07:52:50 2011 +0100 @@ -96,7 +96,22 @@ return firstIsShorter; } -const char* HWChatWidget::STYLE = "a {color:white;} a.nick {text-decoration: none;}"; +const char* HWChatWidget::STYLE = +"\ +a { color:#c8c8ff; }\ +.nick { text-decoration: none; }\ +.UserChat .nick { color:#ffec20; }\ +.FriendChat { color: #08e008; }\ +.FriendChat .nick { color: #20ff20; }\ +.UserJoin { color: #c0c0c0; }\ +.UserJoin .nick { color: #d0d0d0; }\ +.FriendJoin { color: #c0e0c0; }\ +.FriendJoin .nick { color: #d0f0d0; }\ +.UserAction { color: #ff80ff; }\ +.UserAction .nick { color: #ffa0ff; }\ +.FriendAction { color: #ff00ff; }\ +.FriendAction .nick { color: #ff30ff; }\ +"; HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) : QWidget(parent), @@ -332,23 +347,22 @@ if(!nick.isEmpty()) formattedStr.replace("|nick|",QString("%2").arg(QString(nick.toUtf8().toBase64())).arg(nick)); - QString color(""); + QString cssClass("UserChat"); // check first character for color code and set color properly switch (str[0].toAscii()) { case 3: - color = QString("#c0c0c0"); + cssClass = (isFriend ? "FriendJoin" : "UserJoin"); break; case 2: - color = QString(isFriend ? "#00ff00" : "#ff00ff"); + cssClass = (isFriend ? "FriendAction" : "UserAction"); break; default: if (isFriend) - color = QString("#00c000"); + cssClass = "FriendChat"; } - if (!color.isEmpty()) - formattedStr = QString("%1").arg(formattedStr).arg(color); + formattedStr = QString("%1").arg(formattedStr).arg(cssClass); chatStrings.append(formattedStr);