Skip to content

Instantly share code, notes, and snippets.

@jimjam-slam
Last active September 1, 2017 10:50
Show Gist options
  • Save jimjam-slam/0352e4d3874713267d7c8780a3118d62 to your computer and use it in GitHub Desktop.
Save jimjam-slam/0352e4d3874713267d7c8780a3118d62 to your computer and use it in GitHub Desktop.
Add a circular border to each of the circular EmojiOne flags. Useful snippet for the next time I need to use the XML package in about forty years.
library(XML)
for (file in list.files(pattern = glob2rx('*.svg')))
{
message('Processing ', file)
flag = xmlParse(file)
circle_node = newXMLNode('circle',
attrs = c(
'fill' = 'none',
'stroke' = '#333',
'stroke-width' = '1.5px',
'cx' = '32',
'cy' = '32',
'r' = '30'))
flag_mod = addChildren(xmlRoot(flag), kids = list(circle_node))
saveXML(flag_mod, paste0('bordered/', file))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment