# NOT RUN {
# different ways to input red
color_conv("red")
color_conv("#FF0000")
color_conv("#FF0000FF")
color_conv(c(255,0,0))
color_conv("rgb(255,0,0)") # you can use CSS-style text
color_conv(c(255,0,0,255))
# Lab must have names or use text format to be guessed
color_conv(c(l = 53.2, a = 80.1, b = 67.2))
color_conv("lab(53.2,80.1,67.2)")
# else, it will be guessed as rgb; fix by setting from explicitly
color_conv(c(53.2, 80.1, 67.2))
color_conv(c(53.2, 80.1, 67.2), from = "lab")
# add 50% alpha transparency to dodgerblue
color_conv("dodgerblue", alpha = 0.5, to = "rgba")
# }
Run the code above in your browser using DataLab