A package to generate colors from a list of 44 pre-defined palettes

Share:

Description

A package to generate colors from a list of 44 pre-defined palettes

Generate colors from a list of 44 palettes

Usage

1
2
colormap(colormap = colormaps$viridis, nshades = 72, format = "hex",
  alpha = 1, reverse = FALSE)

Arguments

colormap

A string, vector of hex color codes, or a list. Use the colormaps for a list of pre-defined palettes. OR A vector of colors in hex e.g. c('#000000','#777777','#FFFFFF') OR A list of list e.g. list(list(index=0,rgb=c(255,255,255)),list(index=1,rgb=c(255,0,0))) The index should go from 0 to 1. see https://www.npmjs.com/package/colormap#options

nshades

A number. Number of colors to generate.

format

A string. Should be 'hex', 'rgb', or 'rgbaString'

alpha

A Number between 0 and 1

reverse

Boolean. Whether to reverse the order.

Value

Colors either in vector, matrix, list format depending on format.

Author(s)

Bhaskar V. Karambelkar

Examples

1
2
3
4
5
6
7
8
colormap() # Defaults to 72 colors from the 'viridis' palette.
colormap(colormap=colormaps$temperature, nshades=20) # Diff Palette
colormap(colormap=c('#000000','#FF0000'), nshades=20) # Colormap as vector of colors
# list of list. Maximum flexibility
colormap(colormap=list(list(index=0,rgb=c(0,0,0)),list(index=1,rgb=c(255,255,255))), nshades=10)
colormap(format='rgb',nshades=10) # As rgb
colormap(format='rgb',nshades=10,alpha=0.5) # Constant alpha
colormap(format='rgbaString',nshades=10) # As rgba string