Consider the following:
\colorlet{mycolour1}{black}
AND
\colorlet{mycolour2}{black}
How do I use a command like
\ifthenelse{\equal{mycolour1}{mycolour2}}{TRUE}{FALSE}
In other words, how can I check equality between two colors?
Consider the following:
\colorlet{mycolour1}{black}
AND
\colorlet{mycolour2}{black}
How do I use a command like
\ifthenelse{\equal{mycolour1}{mycolour2}}{TRUE}{FALSE}
In other words, how can I check equality between two colors?
I worked it out.
\makeatletter
\extractcolorspec{mycolor1}{\@spec@A}
\extractcolorspec{mycolor2}{\@spec@B}
\ifthenelse{\equal{\@spec@A}{\@spec@B}}{
%TRUE
}{
%FALSE
}
\makeatother
As Werner points out, etoolbox's e-TeX powerful funtionalities are preferable to what ifthen offers. The \ifdefequal is particularly handy here.

\documentclass{article}
\usepackage{etoolbox}
\usepackage{xcolor}
\makeatletter
\newcommand\ifcolorsequalthenelse[4]{%
\extractcolorspec{#1}{\@spec@A}
\extractcolorspec{#2}{\@spec@B}
\ifdefequal{\@spec@A}{\@spec@B}%
{%
#3%
}{%
#4%
}
}
\makeatother
\begin{document}
\colorlet{mycolor1}{red}
\definecolor{mycolor2}{rgb}{1 0 0.1}
\noindent
Test 1:\ifcolorsequalthenelse{mycolor1}{red}{equal}{not equal}\\
Test 2:\ifcolorsequalthenelse{mycolor1}{mycolor2}{equal}{not equal}
\end{document}