ggimage icon indicating copy to clipboard operation
ggimage copied to clipboard

list.icon

Open tjebo opened this issue 2 years ago • 0 comments

the ggimage::list.icon function uses a helper function which looks for png files. This is really not useful, as the icons are svg files. Below a suggestion for a modification - happy to submit pull request if interested.

list_images <- function (url, filetype = "svg") 
{
  x <- readLines(url)
  y <- x[grep(paste0("title=\"[a-zA-Z0-9\\-]+\\.", filetype), x)]
  sub(paste0(".*title=\"([a-zA-Z0-9\\-]+)\\.",filetype, ".*"), "\\1", y)
}

list_icon <- function(){
  list_images("https://github.com/ionic-team/ionicons/tree/master/src/svg")
}

head(list_icon(), 10)
#>  [1] "accessibility-outline" "accessibility-sharp"   "accessibility"        
#>  [4] "add-circle-outline"    "add-circle-sharp"      "add-circle"           
#>  [7] "add-outline"           "add-sharp"             "add"                  
#> [10] "airplane-outline"

tjebo avatar Feb 13 '22 18:02 tjebo