ui: extended color scheme and added new color scheme bad_rainbow
* added color scheme template * define fill, border, text, icon and hatching colors for each node with states normal and focus * define colors for each edge with states normal and focus * use default node and edge colors when no type specific ones are defined * use normal colors for nodes and edges when no focused are defined * allow nodes and edges to imitate look of others with "like" tag * added style for bundle * added style for count circle
This commit is contained in:
@@ -18,19 +18,63 @@ ColorScheme::~ColorScheme()
|
||||
|
||||
std::string ColorScheme::getColor(const std::string& key) const
|
||||
{
|
||||
return getValue<std::string>(key, "#FFFFFF");
|
||||
return getValue<std::string>(key, "");
|
||||
}
|
||||
|
||||
std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string& state) const
|
||||
std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string& key, ColorState state) const
|
||||
{
|
||||
std::string path = "graph/node/" + Node::getTypeString(type) + "/" + state;
|
||||
return getValue<std::string>(path, "#FFFFFF");
|
||||
return getNodeTypeColor(Node::getTypeString(type), key, state);
|
||||
}
|
||||
|
||||
std::string ColorScheme::getEdgeTypeColor(Edge::EdgeType type, const std::string& state) const
|
||||
std::string ColorScheme::getNodeTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const
|
||||
{
|
||||
std::string path = "graph/edge/" + Edge::getTypeString(type) + "/" + state;
|
||||
return getValue<std::string>(path, "#FFFFFF");
|
||||
std::string type = getValue<std::string>("graph/node/" + typeStr + "/like", typeStr);
|
||||
std::string color = getValue<std::string>("graph/node/" + type + "/" + key + "/" + stateToString(state), "");
|
||||
|
||||
if (!color.size() && state != NORMAL)
|
||||
{
|
||||
color = getValue<std::string>("graph/node/" + type + "/" + key + "/" + stateToString(NORMAL), "");
|
||||
}
|
||||
|
||||
if (!color.size())
|
||||
{
|
||||
color = getValue<std::string>("graph/node/default/" + key + "/" + stateToString(state), "");
|
||||
}
|
||||
|
||||
if (!color.size() && state != NORMAL)
|
||||
{
|
||||
color = getValue<std::string>("graph/node/default/" + key + "/" + stateToString(NORMAL), "#FFFFFF");
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
std::string ColorScheme::getEdgeTypeColor(Edge::EdgeType type, ColorState state) const
|
||||
{
|
||||
return getEdgeTypeColor(Edge::getTypeString(type), state);
|
||||
}
|
||||
|
||||
std::string ColorScheme::getEdgeTypeColor(const std::string& typeStr, ColorState state) const
|
||||
{
|
||||
std::string type = getValue<std::string>("graph/edge/" + typeStr + "/like", typeStr);
|
||||
std::string color = getValue<std::string>("graph/edge/" + type + "/" + stateToString(state), "");
|
||||
|
||||
if (!color.size() && state != NORMAL)
|
||||
{
|
||||
color = getValue<std::string>("graph/edge/" + type + "/" + stateToString(NORMAL), "");
|
||||
}
|
||||
|
||||
if (!color.size())
|
||||
{
|
||||
color = getValue<std::string>("graph/edge/default/" + stateToString(state), "");
|
||||
}
|
||||
|
||||
if (!color.size() && state != NORMAL)
|
||||
{
|
||||
color = getValue<std::string>("graph/edge/default/" + stateToString(NORMAL), "#FFFFFF");
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
std::string ColorScheme::getSearchTypeColor(const std::string& searchTypeName, const std::string& state) const
|
||||
@@ -47,3 +91,14 @@ std::string ColorScheme::getSyntaxColor(const std::string& key) const
|
||||
ColorScheme::ColorScheme()
|
||||
{
|
||||
}
|
||||
|
||||
std::string ColorScheme::stateToString(ColorState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case NORMAL: return "normal";
|
||||
case FOCUS: return "focus";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user