Skip to content

Commit

Permalink
re-factor tint and shade functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestguevarra committed Mar 12, 2024
1 parent 65241f4 commit 46a616d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion man/shade_colour.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tint_colour.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 46a616d

Please sign in to comment.