home/src/color_registry.hh
2014-04-18 14:02:14 +01:00

37 lines
793 B
C++

#ifndef color_registry_hh_INCLUDED
#define color_registry_hh_INCLUDED
#include "color.hh"
#include "utils.hh"
#include "completion.hh"
#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);
CandidateList complete_alias_name(StringView prefix,
ByteCount cursor_pos) const;
private:
std::unordered_map<String, ColorPair> m_aliases;
};
inline const ColorPair& get_color(const String& colordesc)
{
return ColorRegistry::instance()[colordesc];
}
}
#endif // color_registry_hh_INCLUDED