hex6to12 <- function(col){
if(is.null(col) ) {""} else{
num <- length(col)
sapply(1:num,
function(i){
if(is.na(col[i]) | col[i] == "NA") ""
else{
# ARGB is 8 digits, with last two representing transparency.
# We have to erase last two digits (TK color codes do not include transparency information)
splitCol <- unlist(strsplit(col[i], split = ""))
if("#" %in% splitCol & length(splitCol) > 7 ) loon::l_hexcolor(paste(splitCol[1:7], collapse = ""))
else if("#" %in% splitCol & length(splitCol) < 7) ""
else loon::l_hexcolor(col[i])
}
}
)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.