Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Theadd
Created November 11, 2013 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Theadd/7422004 to your computer and use it in GitHub Desktop.
Save Theadd/7422004 to your computer and use it in GitHub Desktop.
void HighlightActiveColorFromSVG(XmlElement* xmlSource, bool blackAndWhite = false)
{
forEachXmlChildElement (*xmlSource, xmlnode)
{
forEachXmlChildElement (*xmlnode, xmlouterdefs)
{
forEachXmlChildElement (*xmlouterdefs, xmldefs)
{
String style = xmldefs->getStringAttribute("style");
if (style.isNotEmpty())
{
if (!blackAndWhite) //yellow
{
/*style = style.replace("#008bff", "#e8d500", true);
style = style.replace("#00aaff", "#ffea00", true);
style = style.replace("#4eafff", "#ffdc00", true);*/
style = style.replace("#008bff", "#d9d392", true);
style = style.replace("#00aaff", "#d9d176", true);
style = style.replace("#4eafff", "#d8d3a4", true);
}
else //light gray
{
style = style.replace("#008bff", "#eaeaea", true);
style = style.replace("#00aaff", "#d3d3d3", true);
style = style.replace("#4eafff", "#d8d8d8", true);
}
xmldefs->setAttribute("style", style);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment