Last active
September 1, 2017 10:50
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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