Convert/coerce to CIELAB matrix

pth_to_cielab(color, whitepoint = whitepoints_cie1931("D65"))

pth_new_cielab(mat, whitepoint = whitepoints_cie1931("D65"))

Arguments

color

character or matrix with S3 class pth_mat, a representation of a color.

whitepoint

double array with one dimension, length three; describes the whitepoint reference for the color space.

mat

double matrix with three columns, one row for each color.

Value

double

matrix with S3 classes pth_cielab and pth_mat, with three columns, one row for each color.

Examples

  pth_to_cielab("#663399")
#>            L*       a*        b*
#> [1,] 32.90247 42.88307 -47.14863
#> attr(,"class")
#> [1] "pth_cielab" "pth_mat"   
#> attr(,"whitepoint")
#> [1]  95.047 100.000 108.883
  pth_new_cielab(matrix(c(32.9, 42.9, -47.1), ncol = 3))
#>        L*   a*    b*
#> [1,] 32.9 42.9 -47.1
#> attr(,"class")
#> [1] "pth_cielab" "pth_mat"   
#> attr(,"whitepoint")
#> [1]  95.047 100.000 108.883