#' Queries colors from Aachen color palette
#'
#' @param ... Query of colors. Query colors by combining color name in lower
#' case (check figure generated by
#' \code{\link[=display_aachen_colors]{display_aachen_colors()}} for
#' color names) and color intensity. For colors with 100\% intensity the color
#' name alone is sufficient.
#'
#' @return HEX code of queried colors
#' @export
#'
#' @importFrom dplyr anti_join inner_join pull
#' @importFrom tibble tibble
#'
#' @examples
#' aachen_color("maygreen")
#' aachen_color(c("blue", "blue75", "blue50", "blue25", "blue10"))
aachen_color <- function(...) {
colors <- c(...)
if (!all(colors %in% aachen_colors_df$query)) {
wrong_queries <- tibble::tibble(query = colors) %>%
dplyr::anti_join(aachen_colors_df, by = "query") %>%
dplyr::pull(.data$query)
warning(paste(
"The following queries are not available:",
paste(wrong_queries, collapse = ", ")
))
}
tibble::tibble(query = colors) %>%
dplyr::inner_join(aachen_colors_df, by = "query") %>%
dplyr::pull(.data$hex)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.