R Hex to RGB converter

r

Solution

Based on the comments already given, you can use this code:

x <- "#FF2400FF"
paste(as.vector(col2rgb(x)), collapse = " ")
#> [1] "255 36 0"

However, looking at your requested result, it seems that you have the alpha-value as first hex-number in your `x` - so you need to create a substring:

x <- "#FF2400FF"
paste(as.vector(col2rgb(paste0("#", substr(x, 4, 10)))), collapse = " ")
#> [1] "36 0 255"

Problem

Suppose I have this color in HEX values (including alpha): `x <- "#FF2400FF"` Is there a neat package to convert HEX values to RGB values in R? Or a simple bit of code to do that? `[#1] c("36 0 255")` Edit: This is the opposite way of RGB to Hex converter question

Original source

Related problems