tscv_pal: Create a tscv color palette

View source: R/colors_tscv.R

tscv_palR Documentation

Create a tscv color palette

Description

Create a color interpolation function based on one of the predefined tscv palettes.

Usage

tscv_pal(palette = "main", reverse = FALSE, ...)

Arguments

palette

Character value. Name of the palette.

reverse

Logical value. If TRUE, the palette is reversed.

...

Additional arguments passed to grDevices::colorRampPalette().

Details

tscv_pal() returns a palette function created with grDevices::colorRampPalette(). The returned function can be used to generate any number of colors from the selected palette.

Available palettes are:

  • "main": blue, green, yellow.

  • "cool": blue, green.

  • "hot": yellow, orange, red.

  • "mixed": blue, green, yellow, orange, red.

  • "grey": light grey, dark grey.

Value

A palette function that takes an integer and returns hexadecimal color codes.

See Also

Other data visualization: plot_bar(), plot_density(), plot_histogram(), plot_line(), plot_point(), plot_qq(), scale_color_tscv(), scale_fill_tscv(), theme_tscv(), tscv_cols()

Examples

# Create a palette function
pal <- tscv_pal("main")

# Generate five colors
pal(5)

# Reverse the palette
tscv_pal("hot", reverse = TRUE)(5)

# Use generated colors in base R
barplot(
  height = c(3, 5, 4),
  col = tscv_pal("main")(3)
)

tscv documentation built on May 13, 2026, 9:07 a.m.