Open bakera81 opened 5 years ago
@bakera81 Thanks for filing this. I have been meaning to do this for some time. I have a function that grabs the latest colors from the style guide. I will split them into palettes so that they can be used by calling scale_fill_datacamp()
and scale_color_datacamp
.
get_dc_colors <- function(){
library(rvest)
styleguide <- "http://styleguide.datacamp.com/core.html#bucket"
palette_colors <- styleguide %>%
read_html() %>%
html_nodes(".palette-color")
color_names <- palette_colors %>%
html_nodes('.language-markup') %>%
html_text() %>%
stringr::str_replace("\\$", "") %>%
stringr::str_replace_all("-", "_")
color_hex <- palette_colors %>%
html_nodes('.palette-color__hex') %>%
html_text()
palette <- data_frame(
name = color_names,
hex = color_hex[1:length(color_names)]
)
palette %>%
filter(grepl("^\\#", hex)) %>%
filter(grepl("^dc", name))
}
It would be nice if all official DataCamp colors from the styleguide were included in
dc_pal()
.It would also be nice to have them as a named list, so you know which ones to use where (without having to look up the hexcodes).