Graphics, Figures & TablesPackage xcolor Error:Undefined color model 'red'

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
meehanchr
Posts: 2
Joined: Tue Nov 23, 2010 9:51 pm

Package xcolor Error:Undefined color model 'red'

Post by meehanchr »

Hi, I am trying to add some color to my tables but it has been a very frustrating experience since I am a novice.
I have been using the xcolor package to do this, with the \rowcolor command. The command works perfecty when i use "gray", however as soon as i try any other color(even if I specifically define it) it gives me the error:

Package xcolor Error: Undefined color model 'red'

Any ideas would be useful.
thanks,
Chris





Here is my code...

...
\usepackage{color}
\usepackage{xcolor}
\usepackage[table]{xcolor}
\definecolor{red}{RGB}{255,0,0}

...

\begin{center}
\begin{tabular}{|l|c|c|}
\hline
\multicolumn{3}{|c|}{\bf{Paddle Pinout}} \\
\hline
\rowcolor[red]{.9} Pin \#&(Left Paddle)&(Right Paddle)\\
\hline
1, N.A. & & \\ \hline
2, Red (Power) & 50 & 50\\ \hline
\end{tabular}
\end{center}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Package xcolor Error:Undefined color model 'red'

Post by frabjous »

There happens to be a color model named "gray", and not just a color. There is no color model named "red". There is of course a color named "red", but there is no need to define it. It's built in.

I think it would behoove you to read the xcolor package documentation so you understand the difference between color models and colors.

Also, there is no need to load the color package if you're loading xcolor, and xcolor should only be loaded once.

Also, please pay attention to the Board Rules, and the post on Post on Avoidable Mistakes, especially with regard to putting code in code boxes and always providing complete compiliable minimal working examples.

I suspect what you want is probably something like this:

Code: Select all

\documentclass{article}
\usepackage[table]{xcolor}

\begin{document}

\begin{center}
\begin{tabular}{|l|c|c|}
\hline
\multicolumn{3}{|c|}{\bf{Paddle Pinout}} \\
\hline
\rowcolor{red!90!white} Pin \#&(Left Paddle)&(Right Paddle)\\
\hline
1, N.A. & & \\ \hline
2, Red (Power) & 50 & 50\\ \hline
\end{tabular}
\end{center}
\end{document}
Or perhaps {red!90!black} instead, depending on whether you want it 90% red and 10% white (or 90% red and 10% black). They gray color model just gives just the spectrum from white to black, I wouldn't know how to apply that kind of thinking to red.
meehanchr
Posts: 2
Joined: Tue Nov 23, 2010 9:51 pm

Re: Package xcolor Error:Undefined color model 'red'

Post by meehanchr »

Great! thank you. I did not think of gray as a color model. I will follow the standards of the forum next time I have a question.

Thanks again,
Chris
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Package xcolor Error:Undefined color model 'red'

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic (not the last post) accordingly as written in Section 3 of the Board Rules (to be read before posting). Please keep that in mind for the future so that further reminders will not be necessary.


Best regards and welcome to the board
Thorsten
Post Reply