R/set_calmr_palette.R

Defines functions set_calmr_palette

Documented in set_calmr_palette

#' Get/set the colour/fill palette for plots
#' @param palette A string specifying the available palettes.
#' If NULL, returns available palettes.
#' @return The old palette (invisibly) if palette is not NULL.
#' Otherwise, a character vector of available palettes.
#' @note Changes here do not affect the palette used in graphs.
#' @export

set_calmr_palette <- function(palette = NULL) {
  avail_palettes <- c("viridis", "hue")
  if (is.null(palette)) {
    return(avail_palettes)
  }
  palette <- .assert_valid_palette(palette)
  old <- options("calmr_palette" = palette)
  invisible(old)
}

Try the calmr package in your browser

Any scripts or data that you put into this service are public.

calmr documentation built on June 8, 2025, 1:03 p.m.