Release of version 2.0-0 accompanying the publication of the paper “colorspace: A Toolbox for Manipulating and Assessing Colors and Palettes” in the Journal of Statistcal Software at https://doi.org/10.18637/jss.v096.i01. The paper is a compact version of the package web page (https://colorspace.R-Forge.R-project.org/) including some more discussion of related methods and software along with some more references to the scientific literature.
adjust_transparency() that adjusts the alpha transparency of some color specification and returns a hexadecimal string where the alpha component is modified, added, or removed.
swatchplot() so that color vision deficiency emulation can be included on the fly.
Added binned ggplot2 color scales (in addition to discrete and continuous).
Changed the default colors in
qualitative_hcl(3) which is darker and has more chroma. Also, the order of the legend has been reversed (Luminance / Chroma / Hue) so that the legend labels are closer to the axis that they pertain to.
Improve the documentation of the
HLS() color spaces. These do NOT necessarily correspond to sRGB; we can convert from these to any RGB space that we choose (linear or non-linear, any whitepoint). In particular, if we want to convert from one of these color spaces to XYZ or beyond, we must first convert to a specific RGB color space.
New article/vignette “Somewhere over the Rainbow” with published examples of RGB rainbow palettes (or similar highly saturated and non-monotonic palettes).
Bug fix in
divergingx_hcl(n) with even
n where the two central colors were erroneously duplicated. Also, partial matching of palette names has been fixed.
New sequential multi-hue palette: Purple-Yellow. This is a slightly improved version (i.e., with higher luminance contrast) of the palette used in Figure 4 of Stauffer et al. (2015, BAMS).
New flexible diverging palette Zissou 1 in
divergingx_hcl(). This closely matches the palette of the same name in wesanderson. Note that this is rather unbalanced, has relatively low luminance contrasts and uses very high chroma throughout.
New palette Cividis in
divergingx_hcl() approximating the palette of the same name from the viridis family. While luminance increases monotonically from dark to light in the palette (thus indicating a sequential and not a diverging palette), the hue and chroma trajectories resemble a diverging pattern. Therefore, the flexibility of
divergingx_hcl() is needed and the palette could not be approximated by
Limits of hue axis are improved in
specplot(). Previously, the hues were always matched to [0, 100] on the chroma/luminance axis. Now they are matched to [0, maximum chroma].
Major update of the package that enhances many of its capabilities, e.g., more refined palettes, named palettes, ggplot2 color scales, visualizations for assessing palettes, more and enhanced shiny and Tcl/Tk apps, color vision deficiency emulation, and much more. See below for further details. A new web site presenting and documenting the package has been launched at https://colorspace.R-Forge.R-project.org/
Claus O. Wilke and Claire D. McWhite joined the colorspace team, adding and enhancing various features, including (but not limited to) especially the color vision deficiency emulation, the ggplot2 palettes, and new shiny apps.
hcl_palettes() to query pre-defined HCL-based palettes: qualitative, sequential (single-hue), sequential (multi-hue), diverging. The corresponding
summary() methods can help to explore the palettes.
Pre-defined HCL palettes are taken from previous publications about colorspace as well as approximations from other packages (ColorBrewer.org, CARTO, viridis, scico).
Users can also register their own custom color palettes for subsequent usage (within the same session) in
diverging_hcl() using the
register = "..." argument. To generally make such custom palettes available, a registration R code a la
colorspace::qualitative_hcl(..., register = "myname") can be placed in the
.Rprofile or similar startup scripts. Also the
hclwizard() app allows to register palettes in the current session.
sequential_hcl() is now substantially more flexible: encompasses both single-hue and multi-hue palettes; gained a new parameter
cmax for non-monotonic chroma paths. Parameters
cmax allow to easily modify existing palettes in just a few HCL parameters.
diverging_hcl() is introduced as a copy of
diverge_hcl() for a more consistent naming of the *_hcl palettes where * is one of the adjectives “qualitative”, “sequential”, and “diverging”. Both
diverge_hcl() now also gained a
cmax argument just like
sequential_hcl(). Individual parameters
p2 can also be easily modified.
divergex_hcl() have been added for fully fle_x_ible diverging palettes (as opposed to the more restricted balanced palettes in
diverge_hcl()). These support parameters
Many new predefined palettes that facilitate close approximation of almost all palettes from ColorBrewer.org/RColorBrewer, CARTO/rcartocolor, and viridis. Additionally, approximations to a few of Fabio Crameri’s scientific color maps (scico) are available as well.
New interactive shiny app
hcl_color_picker() - or equivalently,
choose_color() - for exploring HCL colors, and manually assembling individual colors or palettes. Douglas C. Wu (@wckdouglas) provided the original implementation for the color palette feature.
New convenience function
swatchplot() that facilitates displaying color swatches to display and compare collections of color palettes.
specplot() gained an argument
y=NULL to optionally display a second palette and compare their trajectories. By default,
specplot() now only shows the HCL spectrum but not the RGB spectrum (
rgb = FALSE) because it is mainly used for illustrating and comparing properties of HCL-based palettes.
hclplot() for visualizing trajectories of color palettes in two-dimensional HCL space projections.
Added a new function
max_chroma() that (approximately) computes the maximum chroma possible for a given hue and luminance combination in HCL space.
Registration of C routines.
LAB_to_XYZ conversion, replace decimal approximations with exact rational numbers (reported by Glenn Davis). Follows Bruce Lindbloom: http://brucelindbloom.com/index.html?LContinuity.html
whitepoint() that can both query the current whitepoint and set it to a different value. By default CIE D65 with XYZ coordinates 95.047, 100.000, 108.883 is used. But it is possible to set another global whitepoint now, used for all conversions in the package (suggested by Glenn Davis).
desaturate(..., amount = 1) for optional partial desaturation.
as_HLS(), which was passing
coloras the colour to convert (and that was producing not only wrong results, but random results because the values in
answere not initialized). Thanks to Thomas Julou for the report.
In addition to the Tcl/Tk-based GUI for
choose_palette() there is now a shiny-based GUI.
choose_palette() by default still uses the Tcl/Tk version while
hclwizard() is a new wrapper that by default calls the new shiny version.
specplot() that converts a given palette in hex codes to RGB and HCL coordinates and visualizes their spectrum as a line plot.
hex2RGB() now omits the alpha channel (if any) in the hex colors provided.
choose_palette() for sequential palettes with multiple hues: Now two palettes are included in the examples that are very close to “viridis” and “magma” from matplotlib in Python (also available in R via package viridis)
Changed Depends/Imports/Suggests to conform with current R CMD check.
choose_palette()when using palette functions with optional alpha channels.
Alpha channel is preserved in desaturate for named colors (especially
NA). (Reported by Simon Potter.)
Added alpha argument for all palette functions (see
Small fixups for R CMD check.
New Tcl/Tk-based GUI for choosing different types of palettes: qualitative (
rainbow_hcl), single-hue sequential (
sequential_hcl), multi-hue sequential (
heat_hcl), and diverging (
diverge_hcl). The GUI provides a wide collection of pre-stored palettes, easy manipulation of the corresponding arguments, illustration through a broad range of plot types (maps, heatmaps, variations of bar plots, scatter plots, and many more), emulation of desaturation and dichromatic vision, loading/saving palettes, etc.
Bug fix in
.Call() calls now with
PACKAGE = "colorspace".
Added some simple tests based on the examples and vignette.
desaturate() function for removal of chroma in a given vector of colors.
Bug fix in
HLS_to_RGB conversion for
s == 0.
sRGB colorspace. (Existing
RGB colorspace is linearized “sRGB”.)
Conversions to and from
HSL can only occur from or to
sRGB (because both
HSL are relative colorspaces, meaning relative to a particular RGB colorspace). (Converting to or from
RGB gives a different result compared to conversion to or from
gamma parameters in all R-level functions have been deprecated. (The
sRGB colorspace has implicit gamma.)