Introduction to the colouR Package

Welcome to the colouR package, a useful tool for analyzing and utilizing the colors in images, as well as providing color palettes inspired by Radiohead and Taylor Swift album covers. Whether you are a designer looking for inspiration, a data analyst searching for unique ways to visualize data, or a music lover wanting to incorporate your favorite album colors into your projects, this package is for you. It is recommended to view this instructional guide via the GitHub page:

Package Overview

The colouR package provides a set of functions that allows you to:

Key Functions

Some of the main functions included in the colouR package are:

In addition, we provide several utility functions, all of which are demonstrated in this document.

Getting Started

To begin using the colouR package, simply install it from GitHub, load it into your R session, and start exploring the world of colors in images.

# install.packages("devtools")

# Load the package

# Load ggplot2 for making some plots

Get the top n colours in an image

The first function we demonstrate is the getTopCol function. This function reads an image file, extracts the colors, and returns the top n colors based on their frequency in the image. Optionally, black and white shades can be excluded, and the colors can be grouped and averaged (more on colour averaging later!). This function can take in a .jpg, .jpeg, or .png or a url pointing to an image using any of these formats, via the path argument and returns the top n colours used in the image.

Function Arguments

The arguments for this function are:

Input Image

To begin, lets first take a look at a raw image: