getLUV: Get the L*u*v* coordinates of the colors

View source: R/viewers.R

getLUVR Documentation

Get the L*u*v* coordinates of the colors

Description

Given a character vector of colors in any format acceptable to R, this function computes their coordinates in L*u*v* color space.

Usage

getLUV(colorset)

Arguments

colorset

a vector containing color values in any format recognized by R.

Details

The real point of this function is to allow users to plot the colors in three-dimensional space using the rgl package. Because rgl depends on an external installation of XQuartz on Macintosh computers (and because we have found that some students in courses that we teach are apparently unable to install XQuartz, especially if they are using institutional computers without adminstrative privileges), Polychrome no longer imports or depends upon the rgl package, instead relying on scatterplot3d for its 3D plots. The example below shows how to plot a color set using rgl.

Value

Returns a list containing two components: (1) a three-column matrix named coords containing the luminance (L) and hue coordinates (U, V) of each color provided in the input colorset; and (2) a character vector named cset containng a hexadecimal representation of the colorset.

Author(s)

Kevin R. Coombes <krc@silicovore.com>

Examples

data(alphabet)
luv <- getLUV(alphabet)
scatterplot3d::scatterplot3d(luv$coords, color = luv$cset,
    pch = 16, cex.symbol = 3)
## Not run: 
library(rgl)
x <- luv$coords
cset <- luv$cset
open3d(windowRect=c(40, 40, 840, 840))
plot3d(x, main="Alphabet Colors")
spheres3d(x, radius=10, col=cset, shininess=100)

## End(Not run)

Polychrome documentation built on May 3, 2022, 9:07 a.m.