A utility function to convert RGB color values (either a numeric vector or list of vectors) into HEX color codes, with informative feedback.
Value
A HEX color string if a single RGB vector is provided, or a character vector of HEX codes if a list of RGB values is provided.
Examples
# Convert single RGB value
rgb2hex(c(255, 128, 0)) # "#FF8000"
#> ✔ RGB: c(255, 128, 0) → HEX: #FF8000
#> [1] "#FF8000"
# Convert multiple RGB values
rgb2hex(list(c(255, 128, 0), c(0, 255, 0))) # c("#FF8000", "#00FF00")
#> ✔ Converted 2 RGB value(s) to HEX:
#> ℹ RGB: c(255, 128, 0) → HEX: #FF8000
#> ℹ RGB: c(0, 255, 0) → HEX: #00FF00
#> [1] "#FF8000" "#00FF00"