Skip to content

Commit

Permalink
remove munsell as dependency (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand authored Oct 22, 2024
1 parent dd2cf2f commit 1650ae3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Imports:
glue,
labeling,
lifecycle,
munsell (>= 0.5),
R6,
RColorBrewer,
rlang (>= 1.0.0),
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,3 @@ importFrom(graphics,rect)
importFrom(graphics,text)
importFrom(lifecycle,deprecate_soft)
importFrom(lifecycle,deprecated)
importFrom(munsell,mnsl)
18 changes: 11 additions & 7 deletions R/pal-gradient.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ gradient_n_pal <- pal_gradient_n
#' image(r, col = pal_div_gradient()(seq(0, 1, length.out = 30)))
#' image(r, col = pal_div_gradient()(seq(0, 1, length.out = 100)))
#'
#' library(munsell)
#' pal <- pal_div_gradient(low = mnsl(complement("10R 4/6"), fix = TRUE))
#' pal <- pal_div_gradient(low = "#2E6A70")
#' image(r, col = pal(seq(0, 1, length.out = 100)))
#' @importFrom munsell mnsl
pal_div_gradient <- function(low = mnsl("10B 4/6"), mid = mnsl("N 8/0"), high = mnsl("10R 4/6"), space = "Lab") {
pal_div_gradient <- function(
low = "#2B6788", # munsell::mnsl("10B 4/6"),
mid = "#CBCBCB", # munsell::mnsl("N 8/0"),
high = "#90503F", # munsell::mnsl("10R 4/6"),
space = "Lab") {
pal_gradient_n(c(low, mid, high), space = space)
}

Expand All @@ -72,9 +74,11 @@ div_gradient_pal <- pal_div_gradient
#' show_col(pal_seq_gradient()(x))
#' show_col(pal_seq_gradient("white", "black")(x))
#'
#' library(munsell)
#' show_col(pal_seq_gradient("white", mnsl("10R 4/6"))(x))
pal_seq_gradient <- function(low = mnsl("10B 4/6"), high = mnsl("10R 4/6"), space = "Lab") {
#' show_col(pal_seq_gradient("white", "#90503F")(x))
pal_seq_gradient <- function(
low = "#2B6788", # munsell::mnsl("10B 4/6"),
high = "#90503F", # munsell::mnsl("10R 4/6"),
space = "Lab") {
pal_gradient_n(c(low, high), space = space)
}

Expand Down
15 changes: 7 additions & 8 deletions man/pal_div_gradient.Rd

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

7 changes: 3 additions & 4 deletions man/pal_seq_gradient.Rd

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

0 comments on commit 1650ae3

Please sign in to comment.