Last active
August 29, 2015 14:10
-
-
Save uribo/ec45b61b8e83891a0611 to your computer and use it in GitHub Desktop.
Generate Dribbble color palette form genre
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
get_shot_palette <- function (col.n = 8, genre = c("debut", "recent", "teams", "playoffs", "animated")) { | |
base.url <- c("https://dribbble.com") | |
request.url <- html(paste(base.url, "/shots?list=", genre, sep = "")) %>% | |
html_nodes(".dribbble-img a") %>% | |
html_attr("href") %>% | |
head(1) | |
request.url <-paste(base.url, request.url, sep = "") | |
url <- html(request.url) | |
cols <- url %>% | |
html_nodes("ul.color-chips li a") %>% | |
html_attr("title") | |
cols[1:col.n] | |
na.omit(cols) | |
} | |
# 'usage | |
# get_shot_palette(genre = "debut") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment