summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/palette.cpp12
-rw-r--r--src/gui/palette.h3
-rw-r--r--src/gui/theme.cpp12
-rw-r--r--src/gui/widgets/browserbox.cpp5
4 files changed, 23 insertions, 9 deletions
diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp
index f3046264f..348f97de8 100644
--- a/src/gui/palette.cpp
+++ b/src/gui/palette.cpp
@@ -65,15 +65,13 @@ Palette::~Palette()
const gcn::Color& Palette::getColor(char c, bool &valid)
{
- for (Colors::const_iterator col = mColors.begin(),
- colEnd = mColors.end(); col != colEnd; ++col)
+ CharColors::const_iterator it = mCharColors.find(c);
+ if (it != mCharColors.end())
{
- if (col->ch == c)
- {
- valid = true;
- return col->color;
- }
+ valid = true;
+ return mColors[(*it).second].color;
}
+
valid = false;
return BLACK;
}
diff --git a/src/gui/palette.h b/src/gui/palette.h
index 645260280..d46a3c57c 100644
--- a/src/gui/palette.h
+++ b/src/gui/palette.h
@@ -30,6 +30,7 @@
#include <guichan/color.hpp>
#include <cstdlib>
+#include <map>
#include <string>
#include <set>
#include <vector>
@@ -200,8 +201,10 @@ class Palette
}
};
typedef std::vector<ColorElem> Colors;
+ typedef std::map<unsigned char, int> CharColors;
/** Vector containing the colors. */
Colors mColors;
+ CharColors mCharColors;
std::vector<ColorElem*> mGradVector;
};
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 9aa6bb956..b3b28bffa 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -162,6 +162,18 @@ Theme::Theme():
mColors[SERVER].ch = 'S';
mColors[LOGGER].ch = 'L';
mColors[HYPERLINK].ch = '<';
+ mCharColors['H'] = HIGHLIGHT;
+ mCharColors['C'] = CHAT;
+ mCharColors['G'] = GM;
+ mCharColors['Y'] = PLAYER;
+ mCharColors['W'] = WHISPER;
+ mCharColors['w'] = WHISPER_OFFLINE;
+ mCharColors['I'] = IS;
+ mCharColors['P'] = PARTY_CHAT_TAB;
+ mCharColors['U'] = GUILD_CHAT_TAB;
+ mCharColors['S'] = SERVER;
+ mCharColors['L'] = LOGGER;
+ mCharColors['<'] = HYPERLINK;
}
Theme::~Theme()
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 4af38bf67..7d30c10bf 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -79,6 +79,7 @@ BrowserBox::BrowserBox(unsigned int mode, bool opaque):
mColors[PURPLE] = Theme::getThemeColor(Theme::PURPLE);
mColors[GRAY] = Theme::getThemeColor(Theme::GRAY);
mColors[BROWN] = Theme::getThemeColor(Theme::BROWN);
+ setForegroundColor(Theme::getThemeColor(Theme::TEXT));
}
BrowserBox::~BrowserBox()
@@ -406,8 +407,8 @@ int BrowserBox::calcHeight()
char const *hyphen = "~";
int hyphenWidth = font->getWidth(hyphen);
- gcn::Color selColor = Theme::getThemeColor(Theme::TEXT);
- const gcn::Color textColor = Theme::getThemeColor(Theme::TEXT);
+ gcn::Color selColor = getForegroundColor();
+ const gcn::Color textColor = getForegroundColor();
ResourceManager *resman = ResourceManager::getInstance();
mLineParts.clear();