From 46a616d9c34eb0f65c37bc29c54d1d57917feace Mon Sep 17 00:00:00 2001 From: Ernest Guevarra Date: Tue, 12 Mar 2024 10:26:07 +0000 Subject: [PATCH] re-factor tint and shade functions --- R/utils.R | 12 ++---------- man/shade_colour.Rd | 2 +- man/tint_colour.Rd | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/R/utils.R b/R/utils.R index 6371b33..3b11e52 100644 --- a/R/utils.R +++ b/R/utils.R @@ -153,17 +153,13 @@ tint_colour <- function(hex, p) { #' @rdname tint_colour #' @export #' -tint_colours_ <- function(hex, p, label = FALSE) { +tint_colours_ <- function(hex, p) { pal <- Map( f = tint_colour, hex = rep(list(hex), length(p)), p = as.list(p) ) - if (label) { - names(pal) <- paste0(p * 100, "%") - } - unlist(pal) } @@ -219,17 +215,13 @@ shade_colour <- function(hex, p) { #' @rdname shade_colour #' @export #' -shade_colours_ <- function(hex, p, label = FALSE) { +shade_colours_ <- function(hex, p) { pal <- Map( f = shade_colour, hex = rep(list(hex), length(p)), p = as.list(p) ) - if (label) { - names(pal) <- paste0(p * 100, "%") - } - unlist(pal) } diff --git a/man/shade_colour.Rd b/man/shade_colour.Rd index 0d447fe..d9e8510 100644 --- a/man/shade_colour.Rd +++ b/man/shade_colour.Rd @@ -8,7 +8,7 @@ \usage{ shade_colour(hex, p) -shade_colours_(hex, p, label = FALSE) +shade_colours_(hex, p) shade_colours(hex, p, label = FALSE) } diff --git a/man/tint_colour.Rd b/man/tint_colour.Rd index a1f2b17..ed83a58 100644 --- a/man/tint_colour.Rd +++ b/man/tint_colour.Rd @@ -8,7 +8,7 @@ \usage{ tint_colour(hex, p) -tint_colours_(hex, p, label = FALSE) +tint_colours_(hex, p) tint_colours(hex, p, label = FALSE) }