diff --git a/DESCRIPTION b/DESCRIPTION index 1769c40b3..1d2168122 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -63,7 +63,7 @@ Imports: scales (>= 1.0.0), sp, stats, - viridis (>= 0.5.1), + viridisLite, xfun Suggests: knitr, diff --git a/NEWS.md b/NEWS.md index 61b8c8871..59574a64e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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) + * `addRasterImage` now takes `options = gridOptions()`, so that arbitrary Leaflet layer options can be controlled. (#692) # leaflet 2.2.1 diff --git a/R/colors.R b/R/colors.R index 5a816b5b9..e29d15db1 100644 --- a/R/colors.R +++ b/R/colors.R @@ -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 } diff --git a/inst/examples/polygon-colors.R b/inst/examples/polygon-colors.R index f7d134ac3..2e3d00028 100644 --- a/inst/examples/polygon-colors.R +++ b/inst/examples/polygon-colors.R @@ -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, @@ -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, @@ -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,