talira

colorspace

A toolbox for manipulating and assessing colours and palettes in R

open sourceBSD-3-Clausefree

colorspace is an R package for working with colours: it converts between colour spaces (RGB, HSV, HLS, CIEXYZ, CIELUV, HCL, CIELAB and polar CIELAB) and provides qualitative, sequential and diverging palettes built in HCL space, with matching ggplot2 colour scales. Interactive apps (Tcl/Tk or Shiny) help choose a palette, and Shiny apps offer an HCL colour picker and a colour vision deficiency emulator. Plotting functions show palettes as swatches, in HCL space and as HCL or RGB trajectories, and manipulation functions desaturate, lighten, darken and mix colours and simulate deuteranomaly, protanomaly and tritanomaly. It's described in Zeileis et al. (2020) in the Journal of Statistical Software.

Problems it solves

  • choose a colour palette for my R plots that colour-blind readers can tell apart
  • check how my chart's colours look to someone with colour vision deficiency
  • convert colours between RGB, HCL and CIELAB in R

Features

  • conversion between RGB, HSV, HLS, CIEXYZ, CIELUV, HCL and CIELAB
  • qualitative, sequential and diverging HCL palettes with ggplot2 scales
  • interactive palette chooser, HCL colour picker and colour vision deficiency emulator
  • desaturate, lighten, darken and mix colours
  • simulate colour vision deficiencies

Alternatives

The same job

These do what colorspace does.

  1. viridisLite Colour-blind-friendly, perceptually uniform colour maps for base R

Compare colorspace with the top 3