home/src/color_registry.hh

34 lines
644 B
C++
Raw Normal View History

#ifndef color_registry_hh_INCLUDED
#define color_registry_hh_INCLUDED
#include "color.hh"
#include "utils.hh"
2013-04-09 20:05:40 +02:00
#include <unordered_map>
namespace Kakoune
{
class ColorRegistry : public Singleton<ColorRegistry>
{
public:
ColorRegistry();
const ColorPair& operator[](const String& colordesc);
void register_alias(const String& name, const String& colordesc,
bool override = false);
private:
std::unordered_map<String, ColorPair> m_aliases;
};
2013-04-04 18:47:34 +02:00
inline const ColorPair& get_color(const String& colordesc)
{
return ColorRegistry::instance()[colordesc];
}
}
#endif // color_registry_hh_INCLUDED