# generate a palette:
p <- grDevices::palette.colors()
# convert to RGB using col2rgb, then divide by 255 to get it into a
# 0-1 range:
p <- t(col2rgb(p)/ 255 )
# we can adjust the saturation and brightness by the same factor:
p_1 <- adjust_color(p, saturation = 2,
brightness = 1.5,
plotting = TRUE)
# or we can pass a vector for the factors:
p_2 <- adjust_color(p,
saturation = seq(0, 2, length.out = 9),
plotting = TRUE)
# or we can target a single color:
p_3 <- adjust_color(p, which_colors = 4,
saturation = 2, brightness = 2,
plotting = TRUE)
Run the code above in your browser using DataLab