% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generate_colors.R
\name{generate_colors}
\alias{generate_colors}
\title{Generate N Colors from a Specified Color Palette}
\usage{
generate_colors(n, palette = "viridis", ...)
}
\arguments{
\item{n}{\code{integer}. Number of colors to generate. Must be a positive
integer.}

\item{palette}{\code{character(1)}. Name of the color palette to use.
Case-insensitive. Supported options:
\describe{
\item{\strong{viridisLite}}{\code{"viridis"}, \code{"magma"}, \code{"plasma"},
\code{"inferno"}, \code{"cividis"}, \code{"mako"}, \code{"rocket"}, \code{"turbo"}}
\item{\strong{grDevices}}{\code{"hcl"}, \code{"rainbow"}, \code{"heat"},
\code{"terrain"}, \code{"topo"}}
\item{\strong{RColorBrewer}}{Any palette name from
\code{RColorBrewer::brewer.pal.info}, e.g. \code{"Set1"}, \code{"Blues"},
\code{"Dark2"}. If \code{n} exceeds the palette maximum, colors are
interpolated via \code{\link[grDevices]{colorRampPalette}}.}
}}

\item{...}{Additional arguments passed to the underlying palette function.
For example, \code{alpha}, \code{direction}, \code{begin}, \code{end}
are forwarded to \code{\link[viridisLite]{viridis}}; \code{palette} is
forwarded to \code{\link[grDevices]{hcl.colors}}.}
}
\value{
A \code{character} vector of length \code{n} containing hex color
codes (e.g. \code{"#440154FF"}).
}
\description{
A flexible wrapper around multiple color palette libraries, returning N
colors as a character vector of hex codes. Supports palettes from
\pkg{viridisLite}, base R \pkg{grDevices}, and \pkg{RColorBrewer}.
}
\examples{
# viridisLite palettes
generate_colors(5, "viridis")
generate_colors(5, "plasma")
generate_colors(5, "viridis", alpha = 0.8, direction = -1)

# Base R grDevices
generate_colors(5, "rainbow")
generate_colors(8, "hcl", palette = "Dark 3")

# RColorBrewer
generate_colors(5, "Set1")
generate_colors(5, "Blues")
generate_colors(12, "Set1")  # interpolates beyond palette max of 9

# Drop-in replacement for viridisLite::viridis()
# generate_colors(n = length(levels(data_orig[[pri]])), palette = "viridis")

}
\seealso{
\code{\link[viridisLite]{viridis}},
\code{\link[grDevices]{hcl.colors}},
\code{\link[RColorBrewer]{brewer.pal}}
}
