Converting Hex/RGB values to HSL

Hello everyone,

I have an Excel sheet with a bunch of hex/RGB color values like: DD5802 or 221-88-2

I want them to convert into HSL values (I actually only need the L). Are there any packages or other ways to do that?

Thanks in advance

One option is col2hsl from the plotwidgets package:

library(plotwidgets)
library(stringr)

col2hsl("#DD5802")
#>         [,1]
#> H 23.5616438
#> S  0.9820628
#> L  0.4372549

col = c("221-88-2")
col = as.numeric(str_split(col, "-", simplify=TRUE))
col2hsl(rgb(col[1],col[2],col[3],maxColorValue=255))
#>         [,1]
#> H 23.5616438
#> S  0.9820628
#> L  0.4372549

Created on 2020-11-05 by the reprex package (v0.3.0)

thank you so much :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.