The PalCreatoR package is designed to create an R palette using colors from an image. It streamlines the process of pulling out a number of representative colors from the given image and returning the corresponding hexadecimal codes. It also offers the option to get colorblind-friendly colors. Just pick an image of your favorite and pass it into the function: a customized palette is readily available for you! Use it for presentation, publication, or simply for fun!

Background

The idea of creating color palettes from an image is not something new in the R community. Several packages (e.g., imgpalr, paletteR, PNWColors, RImagePalette) and functions (e.g., palettebuildr) have been developed for this purpose, with a wide range of arguments available. Inspired by these works, the PalCreatoR package aims to provide an easy-to-use tool that does the same job while keeping the arguments as simple as possible. It incorporates two features that have so far not yet been implemented in the current functions of its kind:

1) Allowing user to get colorblind-friendly colors converted from the original colors in the palette.

2) Using multivariate Gaussian mixture modeling (GMM), besides the most-used kmeans algorithm, to extract the representative colors from the image.

Installation

The latest version of PalCreatoR can be installed from GitHub:

# install.packages("devtools")
devtools::install_github("GenChangHSU/PalCreatoR")

Examples

Here are some example palettes created with the function create_pal. See Quick Demonstration for more details on its usage.







Contact

Like it? Feel free to reach us at and . Any suggestions or cool ideas are welcome!