Useful for showing discrete palettes

swatch(
  colors,
  height = 40,
  dx = 10,
  margin = 0,
  background = NULL,
  elementId = NULL
)

Arguments

colors

character vector of CSS colors. Can be hex codes, etc.

height

numeric height of widget (pixels).

dx

numeric spacing between color-swatches (pixels).

margin

numeric margin around the canvas (pixels).

background

character CSS color for the canvas background.

elementId

character ID for the enclosing element.

Value

htmlwidget

Examples

swatch(terrain.colors(10))