
Convert 12 hexadecimal digit color representations to 6 hexidecimal digit color representations
Source:R/l_ColorList.R
hex12tohex6.Rd
Tk colors must be in 6 hexadecimal format with two hexadecimal digits for each of the red, green, and blue components. Twelve hexadecimal digit colors have 4 hexadecimal digits for each. This function converts the 12 digit format to the 6 provided the color is preserved.
Details
Function throws a warning if the conversion loses information. The
l_hexcolor
function converts any Tcl color specification to a
12 digit hexadecimal color representation.
Examples
x <- l_hexcolor(c("red", "green", "blue", "orange"))
x
#> [1] "#FFFF00000000" "#000080800000" "#00000000FFFF" "#FFFFA5A50000"
hex12tohex6(x)
#> [1] "#FF0000" "#008000" "#0000FF" "#FFA500"