Skip to content

Commit

Permalink
Replace {viridis} dependency by {viridisLite} (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy authored Feb 16, 2024
1 parent e15a997 commit 7ae5ca3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Imports:
scales (>= 1.0.0),
sp,
stats,
viridis (>= 0.5.1),
viridisLite,
xfun
Suggests:
knitr,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Fixed #893: Correctly call `terra::crs()` when checking the CRS of a `SpatVector` object in `pointData()` or `polygonData()` (thanks @mkoohafkan, #894).

* Replace viridis dependency by viridisLite (@olivroy, #897)

# leaflet 2.2.1

* When `addProviderTiles()` is used with `{leaflet.providers}` version 2.0.0 or later, the `leaflet-providers` HTML dependency produced can be correctly cached by knitr. When used with older versions of `{leaflet.providers}`, the HTML dependency uses temp files that break knitr's caching mechanism (thanks @qdread, @jaredlander; #884).
Expand Down
2 changes: 1 addition & 1 deletion R/colors.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ toPaletteFunc.character <- function(pal, alpha, nlevels) {
colors <- brewer_pal(pal) # Get all colors
}
} else if (length(pal) == 1 && pal %in% c("viridis", "magma", "inferno", "plasma")) {
colors <- viridis::viridis(n = 256, option = pal)
colors <- viridisLite::viridis(n = 256, option = pal)
} else {
colors <- pal
}
Expand Down
6 changes: 3 additions & 3 deletions inst/examples/polygon-colors.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ leaf <- leaflet(spdf)
#'
#' ### Quantiles

qpal <- colorQuantile(rev(viridis::viridis(10)), spdf$POPDENSITY, n = 10)
qpal <- colorQuantile(rev(viridisLite::viridis(10)), spdf$POPDENSITY, n = 10)

leaf %>%
addPolygons(weight = 1, color = "#333333", fillOpacity = 1,
Expand All @@ -55,7 +55,7 @@ leaf %>%
#'
#'
#' ### Bins
binpal <- colorBin(rev(viridis::viridis(10)), spdf$POPDENSITY, bins = 10)
binpal <- colorBin(rev(viridisLite::viridis(10)), spdf$POPDENSITY, bins = 10)

leaf %>%
addPolygons(weight = 1, color = "#333333", fillOpacity = 1,
Expand All @@ -67,7 +67,7 @@ leaf %>%
#'
#'
#' ### Numeric
numpal <- colorNumeric(rev(viridis::viridis(256)), spdf$POPDENSITY)
numpal <- colorNumeric(rev(viridisLite::viridis(256)), spdf$POPDENSITY)

leaf %>%
addPolygons(weight = 1, color = "#333333", fillOpacity = 1,
Expand Down

0 comments on commit 7ae5ca3

Please sign in to comment.