% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/toRGB.R
\name{toRGB}
\alias{toRGB}
\title{Convert R colours to RGBA hexadecimal colour values}
\usage{
toRGB(x, alpha = 1)
}
\arguments{
\item{x}{see the \code{col} argument in \code{col2rgb} for valid specifications}

\item{alpha}{alpha channel on 0-1 scale}
}
\value{
hexadecimal colour value (if is.na(x), return "transparent" for compatibility with Plotly)
}
\description{
Convert R colours to RGBA hexadecimal colour values
}
\examples{
\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}

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)
\dontshow{\}) # examplesIf}
}
\seealso{
\code{\link[=showRGB]{showRGB()}}
}
