toRGB: Convert R colours to RGBA hexadecimal colour values

Description Usage Arguments Value See Also Examples

View source: R/toRGB.R

Description

Convert R colours to RGBA hexadecimal colour values

Usage

1
toRGB(x, alpha = 1)

Arguments

x

see the col argument in col2rgb for valid specifications

alpha

alpha channel on 0-1 scale

Value

hexadecimal colour value (if is.na(x), return "transparent" for compatibility with Plotly)

See Also

showRGB()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
toRGB("steelblue") 
# [1] "rgba(70,130,180,1)"

m <- list(
  color = toRGB("red"),
  line = list(
    color = toRGB("black"), 
    width = 19
  )
)

plot_ly(x = 1, y = 1, marker = m)

plotly documentation built on Nov. 8, 2019, 1:07 a.m.