diff --git a/DESCRIPTION b/DESCRIPTION index 76ee4e314..2c7c26976 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 dc1d14a45..f28302ce8 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) + # 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). 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,