Skip to contents

Convert RGB colors (0-1 range) to HSL (hue-saturation-luminance) space. Used for passing RGB colors to pavo::adjacent.

Usage

rgb2hsl(rgb_matrix, radians = TRUE, pavo_hsl = TRUE)

Arguments

rgb_matrix

RGB colors in an nx3 matrix (rows = colors, columns = channels).

radians

Logical. Return HSL colors in units of radians (TRUE) or degrees (FALSE)?

pavo_hsl

Logical. Return HSL matrix in a format that can be passed directly to pavo::adjacent as the hsl parameter?

Value

A dataframe with patch, hue, sat, and lum columns and one row per color (if pavo_hsl = TRUE) or a matrix of the HSL coordinates (if pavo_hsl = FALSE).