2012-09-17 19:01:13 +02:00
|
|
|
#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>
|
|
|
|
|
2012-09-17 19:01:13 +02:00
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class ColorRegistry : public Singleton<ColorRegistry>
|
|
|
|
{
|
|
|
|
public:
|
2013-03-06 20:31:07 +01:00
|
|
|
ColorRegistry();
|
|
|
|
|
2012-09-17 19:01:13 +02:00
|
|
|
const ColorPair& operator[](const String& colordesc);
|
2012-09-17 21:01:11 +02:00
|
|
|
void register_alias(const String& name, const String& colordesc,
|
|
|
|
bool override = false);
|
2012-09-17 19:01:13 +02:00
|
|
|
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
|
2012-09-17 19:01:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // color_registry_hh_INCLUDED
|
|
|
|
|