Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Change default color schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Jun 27, 2024
1 parent b8f54a4 commit 0bc05bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions R/palettes.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ palette_color_continuous <- function(colors = NULL, domain = NULL,

OK <- !is.na(x)
if (is.null(colors)) {
colors <- grDevices::hcl.colors(12, "YlOrRd", rev = TRUE)
colors <- color(palette = "YlOrBr")(9)
}
colors <- grDevices::colorRamp(colors)(x[OK], ...)

Expand Down Expand Up @@ -152,7 +152,7 @@ palette_color_discrete <- function(colors = NULL, domain = NULL,

OK <- !is.na(x)
if (is.null(colors)) {
colors <- grDevices::hcl.colors(n, "viridis")
colors <- color(palette = "discreterainbow")(n)
}

if (length(colors) < n) {
Expand Down
6 changes: 3 additions & 3 deletions inst/tinytest/test_palettes.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ expect_warning(palette_color_picker(scheme = "bright")(c(1, 2, 3, 4, 5, 6, 7)))
## Continuous ------------------------------------------------------------------
expect_identical(
palette_color_continuous()(c(1, 2, 3)),
c("#FFFFC8", "#F39200", "#7D0025")
c("#FFFFE5", "#FB9A29", "#662506")
)
expect_identical(
palette_color_continuous(bw)(c(0, 0.5, 1)),
Expand Down Expand Up @@ -70,8 +70,8 @@ expect_identical(

## Discrete --------------------------------------------------------------------
expect_identical(
palette_color_discrete(NULL, LETTERS)(lvl),
c("#4B0055", "#4B0055", "#462169", "#4A0E5F", "#4B0055", "#4A0E5F")
palette_color_discrete(NULL, domain = LETTERS[1:23])(lvl),
c("#E8ECFB", "#E8ECFB", "#CAACCB", "#D9CCE3", "#E8ECFB", "#D9CCE3")
)
expect_identical(
palette_color_discrete(c("#4477AA", "#EE6677", "#228833"), domain = c("A", "B", "C"))(lvl),
Expand Down

0 comments on commit 0bc05bf

Please sign in to comment.