Put all colors into single xml file. Accessing colors is handled via the singleton class ColorScheme. The default scheme "bright.xml" holds the original colors. The scheme "dark.xml" is a start, but still a poor alternative. Color schemes can be switched via the View menu.
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
#include "settings/ColorScheme.h"
|
|
|
|
std::shared_ptr<ColorScheme> ColorScheme::s_instance;
|
|
|
|
std::shared_ptr<ColorScheme> ColorScheme::getInstance()
|
|
{
|
|
if (!s_instance)
|
|
{
|
|
s_instance = std::shared_ptr<ColorScheme>(new ColorScheme());
|
|
}
|
|
|
|
return s_instance;
|
|
}
|
|
|
|
ColorScheme::~ColorScheme()
|
|
{
|
|
}
|
|
|
|
std::string ColorScheme::getColor(const std::string& key) const
|
|
{
|
|
return getValue<std::string>(key, "#FFFFFF");
|
|
}
|
|
|
|
std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string& state) const
|
|
{
|
|
std::string path = "graph/node/" + Node::getTypeString(type) + "/" + state;
|
|
return getValue<std::string>(path, "#FFFFFF");
|
|
}
|
|
|
|
std::string ColorScheme::getEdgeTypeColor(Edge::EdgeType type, const std::string& state) const
|
|
{
|
|
std::string path = "graph/edge/" + Edge::getTypeString(type) + "/" + state;
|
|
return getValue<std::string>(path, "#FFFFFF");
|
|
}
|
|
|
|
std::string ColorScheme::getQueryNodeTypeColor(QueryNode::QueryNodeType type, const std::string& state) const
|
|
{
|
|
std::string path = "search/query/" + QueryNode::queryNodeTypeToString(type) + "/" + state;
|
|
return getValue<std::string>(path, "#FFFFFF");
|
|
}
|
|
|
|
std::string ColorScheme::getSyntaxColor(const std::string& key) const
|
|
{
|
|
return getValue<std::string>("code/snippet/syntax/" + key, "#FFFFFF");
|
|
}
|
|
|
|
ColorScheme::ColorScheme()
|
|
{
|
|
}
|