int
Svg_parser::getRed(String hex){
if(hex.at(0)=='#'){
+ //allow for 3-digit hex codes (#rgb = #rrggbb)
+ if (hex.length()<7) return (16+1) * hextodec(hex.substr(1,1));
return hextodec(hex.substr(1,2));
}else if(hex.compare(0,3,"rgb")==0 || hex.compare(0,3,"RGB")==0){
int start=hex.find_first_of("(")+1;
int
Svg_parser::getGreen(String hex){
if(hex.at(0)=='#'){
+ if (hex.length()<7) return (16+1) * hextodec(hex.substr(2,1));
return hextodec(hex.substr(3,2));
}else if(hex.compare(0,3,"rgb")==0 || hex.compare(0,3,"RGB")==0){
int start=hex.find_first_of("(")+1;
int
Svg_parser::getBlue(String hex){
if(hex.at(0)=='#'){
+ if (hex.length()<7) return (16+1) * hextodec(hex.substr(3,1));
return hextodec(hex.substr(5,2));
}else if(hex.compare(0,3,"rgb")==0 || hex.compare(0,3,"RGB")==0){
int start=hex.find_first_of("(")+1;