Added cols_impact()

This commit is contained in:
gnoblet 2022-09-18 20:31:22 -04:00
parent 106fddc8ea
commit 9289acbfe9

30
R/cols_impact.R Normal file
View file

@ -0,0 +1,30 @@
#' @title Function to extract IMPACT colors as hex codes
#'
#' @param ... Character names of reach colors. If NULL returns all colors
#' @param unnamed Should the output vector be unnamed? Default to `TRUE`
#'
#' @return An hex code or hex codes named or unnamed
#'
#' @details This function needs to be modified to add colors
#'
#' @export
cols_impact <- function(..., unnamed = TRUE) {
cols <- c(...)
colors_impact <- c(white = "#FFFFFF",
black = "#000000",
main_blue = "#315975",
main_gray = "#58585A")
if (is.null(cols)) {
cols_to_return <- colors_impact
} else {
cols_to_return <- colors_impact[cols]
}
if(unnamed){
cols_to_return <- unname(cols_to_return)
}
return(cols_to_return)
}