# Clear xcolor color definition

I'm trying to create a command that creates colour palettes from a partially complete set of defined colours.

In order to make sure the palette is complete I use lines like this to use a fallback default if it isn't included. \@ifundefined{\string\color@Red}{\definecolor{Red}{HTML}{eb3b47}}{} This obviously relies of the colour Red being undefined before the palette is set.

To try to ensure this, before the palette is set, I run \let\color@Red\undefined. Unfortunately this doesn't seem to affect the colour definition at all, and hence this doesn't work.

This is rather important functionality, as without it switching palettes doesn't really work. Google is yet to help, so I was hoping someone might be able to point me in the right direction.

## MWE

\documentclass{article}

\usepackage{xcolor}

\begin{document}

\definecolor{Red}{HTML}{eb3b47}
\textcolor{Red}{This is Some Text}
\makeatletter
\let\color@Red\undefined
\makeatother
% Red should be undefined --- it isn't
\textcolor{Red}{This is Some Text}

\end{document}


• \expandafter\let\csname\string\color@Red\endcsname\undefined – Henri Menke Jun 16 at 6:20

You think a colour defined via \definecolor{foo}{.}{..} creates \color@foo. However, it actually creates \\color@foo. So, to undefine the colour, use
\expandafter\let\csname\string\color@Red\endcsname\undefined