Skip to content

Commit

Permalink
Merge pull request #68 from katilingban/dev
Browse files Browse the repository at this point in the history
re-factor tint and shade functions
  • Loading branch information
ernestguevarra authored Mar 12, 2024
2 parents 6208f77 + 46a616d commit f2c2998
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 f2c2998

Please sign in to comment.