% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/theme.R
\name{apply_gg_colors}
\alias{apply_gg_colors}
\title{Apply brand colours to a ggplot object}
\usage{
apply_gg_colors(p, colors = NULL, n_groups = NULL, group_levels = NULL)
}
\arguments{
\item{p}{A ggplot object.}

\item{colors}{Character vector, palette name string, or NULL.}

\item{n_groups}{Integer. Number of groups in the data. Drives which
palette rule fires. Passed from \code{ggplot_engine()}.}

\item{group_levels}{Character vector or NULL. Group level names in data
order. Used to name the palette so ggplot2 matches colours to groups
by name rather than alphabetical sort.}
}
\value{
The modified ggplot object.
}
\description{
Uses the same \code{resolve_colors()} priority chain as the highcharter
engine so both backends always produce identical colour assignments:
}
\details{
\enumerate{
\item Explicit \code{colors} argument
\item \code{getOption("highdir.colors")} session default
\item Built-in rules: n==2 -> hdir2, n<=10 -> \code{hdir[1:n]}, n>10 -> viridis
}
}
\keyword{internal}
