% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xl_format.R
\name{xl_color}
\alias{xl_color}
\title{Normalize a color to a libxlsxwriter RGB integer}
\usage{
xl_color(x)
}
\arguments{
\item{x}{A single color: an R color name, a hex string, or an integer.
`NA` returns `NA_integer_` (an unset color).}
}
\value{
A single integer in `0x000000`..`0xFFFFFF`, or `NA_integer_`.
}
\description{
Converts an R color name (e.g. `"navy"`), a hex string (`"#FF0000"` or
`"FF0000"`), or an integer in the range `0x000000`..`0xFFFFFF` into the
single `0xRRGGBB` integer that libxlsxwriter expects.  Used internally by
every `color`/`background`/`foreground` argument of the formatting
constructors, and exported so it can be used directly.
}
\examples{
xl_color("red")
xl_color("#0000FF")
xl_color(255L)
}
\seealso{
Other cell formatting:
\code{\link[=is_xl_format]{is_xl_format()}},
\code{\link[=xl_format]{xl_format()}},
\code{\link{xl_format_groups}}
}
\concept{cell formatting}
