Skip to content

Commit

Permalink
remove munsell as dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 10, 2024
1 parent 6e5e4c3 commit 4df5e6f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
3 changes: 1 addition & 2 deletions 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 All @@ -39,4 +38,4 @@ Config/testthat/edition: 3
Encoding: UTF-8
LazyLoad: yes
Roxygen: list(markdown = TRUE, r6 = FALSE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,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 4df5e6f

Please sign in to comment.