% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generate_colors.R
\name{continuous_colors}
\alias{continuous_colors}
\title{Create a Continuous Color Function from a Palette}
\usage{
continuous_colors(palette = "viridis", n = 256, ...)
}
\arguments{
\item{palette}{Passed directly to \code{\link[=generate_colors]{generate_colors()}}. Either a palette
name string or a function.}

\item{n}{\code{integer}. Resolution of the underlying color ramp — higher
values give smoother gradients. Defaults to 256.}

\item{...}{Additional arguments passed to \code{\link[=generate_colors]{generate_colors()}}.}
}
\value{
A function that takes a numeric vector of values in \code{[0, 1]}
and returns a character vector of hex colors.
}
\description{
Wraps \code{\link{generate_colors}} into a function that accepts a value
between 0 and 1 and returns the corresponding color. Useful for mapping
continuous variables to colors.
}
\examples{
pal <- continuous_colors("viridis")
pal(0)    # first color
pal(1)    # last color
pal(0.5)  # midpoint

# Map a continuous variable to colors
values <- seq(0, 1, length.out = 10)
pal(values)

# Works with any palette generate_colors() accepts
pal <- continuous_colors("plasma", direction = -1)
pal <- continuous_colors(\(n) hcl.colors(n, palette = "Blue-Red"))

}
\seealso{
\code{\link[=generate_colors]{generate_colors()}}
}
