% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotly_Utils.R
\name{opposite_color}
\alias{opposite_color}
\title{Find opposite color with max contrast}
\usage{
opposite_color(
  col,
  method = c("complement", "complement_maxcontrast", "bw_maxcontrast"),
  degrees = 180
)
}
\arguments{
\item{col}{A color name or hex string (e.g. "red", "#FF0000", "#FF0000FF").}

\item{method}{The method to use for finding the opposite color.
One of "complement", "complement_maxcontrast", or "bw_maxcontrast".
Default is "complement".}

\item{degrees}{The degree offset for the hue complement. Default is 180.}
}
\value{
A hex color string in the format "#RRGGBBAA".
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
Finds an opposite color with maximum contrast to the input color.
}
\details{
This function takes a color input (name or hex) and returns an opposite color
using one of three methods:
\itemize{
\item "complement": strict 180 degrees hue complement
\item "complement_maxcontrast": 180 degrees hue complement adjusted for maximum contrast
\item "bw_maxcontrast": black or white, whichever has higher contrast
The function uses the WCAG relative luminance and contrast ratio formulas to determine contrast.
}
}
