Define New Color in LaTeX – Custom Color Definitions

color

I'm using

\usepackage[dvipsnames]{xcolor}

to use RoyalPurple color, but now I wanted to redefine it to

\definecolor{light-RoyalPurple}{RoyalPurple}{0.85}

But I get

! Package xcolor Error: Undefined color
model `RoyalPurple'.

that doesn't happen with

\definecolor{light-gray}{gray}{0.85}

So I think that \definecolor just works with "normal" colors… how to solve it?

Best Answer

It's not working because you're giving the command an unexpected value. The second argument of \definecolor expects one of the color models from this list:

natural, rgb, cmy, cmyk, hsb, gray, RGB, HTML, HSB, Gray

That's why gray worked in your case. Try replacing that with blue and you'll get the same error. If you want a lighter version of RoyalPurple, use \colorlet.

Output

enter image description here

Code

\documentclass[margin=10pt]{standalone}
\usepackage[dvipsnames]{xcolor}

\colorlet{lRP}{RoyalPurple!85} 

\begin{document}\Huge\bfseries
Black \textcolor{lRP}{Light} \textcolor{RoyalPurple}{Regular} 
\end{document}