From 53ca6cadd746f27e0810af16b83c0c3aa6fbdee2 Mon Sep 17 00:00:00 2001 From: jiajic <72078254+jiajic@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:16:12 -0500 Subject: [PATCH] Update color_palettes.R set a seed for `getDistinctColors()` for when more than 444 colors are requested. --- R/color_palettes.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/color_palettes.R b/R/color_palettes.R index 767f589..020361c 100644 --- a/R/color_palettes.R +++ b/R/color_palettes.R @@ -139,6 +139,8 @@ getDistinctColors <- function(n) { # if too many colors warn about recycling if(n > length(broad_colors)) { warning('\n not enough unique colors in R, maximum = 444 \n') + set.seed(1234) + on.exit(set.seed(Sys.time())) col_vector = sample(x = broad_colors, size = n, replace = TRUE) } else { col_vector = sample(x = broad_colors, size = n, replace = FALSE)