Colour space conversion

This is the raison d’être of the package. Take a matrix or data frame with colour channels in the columns, and convert it from one colour space to another. Channels are automatically capped if they have defined bounds, and any NaN, NA, Inf, or -Inf values in the input will result in a row of NA values in the output.

convert_colour()

Convert between colour spaces

Colour comparison

Getting a numeric value describing the distance between two colours is not a trivial task, and several metrics have been devised for that. farver supports a range of these, and allows you to compare colours in any space with each others.

compare_colour()

Calculate the distance between colours

Converting to and from colour strings

The native format of colours in R (and other languages) is often hexadecimal encoded rgb values (#RRGGBB). farver provides utilities for easily going back and forth between this and any colour space.

encode_colour()

Encode colours into RGB hex-strings

decode_colour()

Decode RGB hex-strings into colour values

Colour string manipulation

As colours are often encoded as strings, manipulation of individual channels requires decoding. and then encoding. farver does away with that by providing a range of functions for directly manipulating channels in colour strings.

set_channel() add_to_channel() multiply_channel() raise_channel() cap_channel() get_channel()

Modify colour space channels in hex-encoded colour strings