# Bad colors in table using baposter

I'm trying to assign specific colors to table cells in a poster (baposter). Unfortunately they are reproduced different in the pdf. As they have to match the colors of my graphs I need precisely the specified ones. In my presentation (beamer class) the colors are reproducing nicely using the same code. Therefore I assume the table and use of \cellcolor is fine.

Please find a working example below:

\documentclass[a0paper,portrait]{baposter}
\usepackage{relsize} % Used for making text smaller in some places
\usepackage{color, colortbl}  % define own fancy colours
\graphicspath{{figures/}} % Directory in which figures are stored

\definecolor{VeryCold}{HTML}{000000}  % becomes 231F20 in the pdf
\definecolor{Cold}{HTML}{FFFFFF}  % stays FFFFFF in the pdf
\definecolor{Cool}{HTML}{FF0000}  % becomes ED1C24 in the pdf
\definecolor{SlightlyCool}{HTML}{00FF00}  % becomes 00A650 in the pdf
\definecolor{Comfortable}{HTML}{0000FF}  % becomes 2E3192 in the pdf
%\definecolor{Comfortable}{RGB}{00, 00, 255}  % no difference so the method to define the colors should be fine

\begin{document}

\background{ % Set the background to an image (background.pdf)
\begin{tikzpicture}[remember picture,overlay]
\draw (current page.north west)+(-2em,2em) node[anchor=north west]
%{\includegraphics[height=0.0852\textheight, width=0.9842\textwidth]{backgroundBlau}};  % 0.968
{ };
\end{tikzpicture}
}

\begin{poster}{
grid=false,
borderColor=Cold, % Border color of content boxes
headerColorOne=Cold, % Background color for the header in the content boxes (left side)
headerColorTwo=Cold, % Background color for the header in the content boxes (right side)
headerFontColor=Comfortable, % Text color for the header text in the content boxes
boxColorOne=white, % Background color for the content in the content boxes
headerfont=\Large\sf\bf, % Font modifiers for the text in the content box headers
textborder=rectangle,
background=user,
headerborder=open, % Change to closed for a line under the content box headers
}
{}
%
{\sf\bf \textsmaller[1]{\textcolor{white}{ text }}} % Poster title
{\vspace{0.1em} text \\ % Author names
{\smaller text }} % Author email addresses
%{\includegraphics[scale=0.55]{Uni_Logo-Grundversion_E1_A4_CMYK}} % University/lab logo

\textsmaller[1]{
\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
\rowcolor{Comfortable}\multicolumn{1}{|c|}{PET} & \multicolumn{1}{|c|}{eption} & \multicolumn{1}{|c|}{ Stress} & \multicolumn{1}{|c|}{Color} \\ \hline \hline
< 4 & ld & ress & \cellcolor{VeryCold}\\ \hline
4 - 8 & old & sts & \cellcolor{Cold} \\ \hline
8 - 13 & ol &  ss & \cellcolor{Cool} \\ \hline
13 - 18 & ool & s & \cellcolor{SlightlyCool} \\ \hline
18 - 23 & e & st & \cellcolor{Comfortable} \\ \hline
\hline
\end{tabular}
\end{center}
}

}

\end{poster}
\end{document}


The colors in this test example should be black, white, red, green, blue. While white seem to stay white in the pdf, black is greyish and red, green and blue are way to dark. They seem to be changed during compilation.

I also tried specifying the test colors using RGB instead of HTML. As this had no effect on the color in the pdf (it was exactly the same wrong) I guess that they are specified correctly (furthermore they work well in the beamer class). There seems to be some strange stuff happening only using baposter that changes my colors…

To give you a clue about the changed colors, I measured the colors in the pdf using the color selector in gimp, that returns the RGB value (in LaTeX called HTML) and added them as a comment behind the applied specification.

Any idea is highly appreciated!

• you are specifying them numerically so can have any shade you want eg {0000FF} is black for the R and G components so you can make it lighter as {9999FF} or whatever you want. The colours are presumably unrelated to baposter? – David Carlisle Dec 3 '14 at 15:58
• It would be helpful if you made your examples minimal using a standard class such as article and removing packages unrelated to the problem such as hevelt, natbib and booktabs and caption – David Carlisle Dec 3 '14 at 16:02
• Well, it appears the colors are not unrelated to baposter, thats why I chose the long example. Actually they are exactly what I expect them to be if I compile the same using the beamer class, while in my example (in baposter) e.g. 0000FF results in 2E3192. As I have no Idea why, I kept some more stuff. I'll continue testing and remove some unnecessary packages. – dom Dec 3 '14 at 16:24
• what do you mean by 0000FF results in 2E3192 ? 0000FF is 0 in red and green and 255 in blue what colour model do you mean by 2E3192 and why not just specify the colour as that if that is what you want? – David Carlisle Dec 3 '14 at 16:28
• I assume that bacolor will be the same as article with \usepackage[cmyk]{xcolor} as it loads that and doesn't do anything else colour related. You may prefer to specify colours using cmyk rather than HTML (which is RGB) – David Carlisle Dec 3 '14 at 16:31

This problem is corrected by ensuring that the colour model is explicitly declared in the preamble, using \setcolormodel{HTML}.

Although it does not appear to make a difference in this instance, the xcolor manual (table 2, p10) specifically instructs that colortbl should be passed as an option to xcolor. However, the baposter class loads xcolor, since it is based on pgf, so it is necessary to use \PassOptionsToPackage{table}{xcolor} before the declaration of the baposter document class. In the modified MWE below, I extended this to make provision for using colour names defined using dvipsnames and svgnames, thus: \PassOptionsToPackage{table,dvipsnames,svgnames}{xcolor}.

These two small modifications provide the correct colours, and the opportunity to use an extended range of color definitions - no need to hack the baposter class.

The code is:

\PassOptionsToPackage{table,dvipsnames,svgnames}{xcolor} %<-- Pass colortbl and defined colours to xcolor
\documentclass[a0paper,portrait]{baposter}
\usepackage{relsize} % Used for making text smaller in some places
%\usepackage{color, colortbl}  % define own fancy colours
\graphicspath{{figures/}} % Directory in which figures are stored

\selectcolormodel{HTML} %<-- Add colour model defintion
\definecolor{VeryCold}{HTML}{000000}  % becomes 231F20 in the pdf
\definecolor{Cold}{HTML}{FFFFFF}  % stays FFFFFF in the pdf
\definecolor{Cool}{HTML}{FF0000}  % becomes ED1C24 in the pdf
\definecolor{SlightlyCool}{HTML}{00FF00}  % becomes 00A650 in the pdf
\definecolor{Comfortable}{HTML}{0000FF}  % becomes 2E3192 in the pdf
%\definecolor{Comfortable}{RGB}{00, 00, 255}  % no difference so the method to define the colors should be fine

\begin{document}

\background{ % Set the background to an image (background.pdf)
\begin{tikzpicture}[remember picture,overlay]
\draw (current page.north west)+(-2em,2em) node[anchor=north west]
%{\includegraphics[height=0.0852\textheight, width=0.9842\textwidth]{backgroundBlau}};  % 0.968
{ };
\end{tikzpicture}
}

\begin{poster}{
grid=false,
borderColor=Cold, % Border color of content boxes
headerColorOne=Cold, % Background color for the header in the content boxes (left side)
headerColorTwo=Cold, % Background color for the header in the content boxes (right side)
headerFontColor=Comfortable, % Text color for the header text in the content boxes
boxColorOne=white, % Background color for the content in the content boxes
headerfont=\Large\sf\bf, % Font modifiers for the text in the content box headers
textborder=rectangle,
background=user,
headerborder=open, % Change to closed for a line under the content box headers
}
{}
%
{\sf\bf \textsmaller[1]{\textcolor{white}{ text }}} % Poster title
{\vspace{0.1em} text \\ % Author names
{\smaller text }} % Author email addresses
%{\includegraphics[scale=0.55]{Uni_Logo-Grundversion_E1_A4_CMYK}} % University/lab logo

\textsmaller[1]{
\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
\rowcolor{Cold}\multicolumn{1}{|c|}{PET} & \multicolumn{1}{|c|}{eption} & \multicolumn{1}{|c|}{ Stress} & \multicolumn{1}{|c|}{Color} \\ \hline \hline
< 4 & ld & ress & \cellcolor{VeryCold}\\ \hline
4 - 8 & old & sts & \cellcolor{Cold} \\ \hline
8 - 13 & ol &  ss & \cellcolor{Cool} \\ \hline
13 - 18 & ool & s & \cellcolor{SlightlyCool} \\ \hline
18 - 23 & e & st & \cellcolor{Comfortable} \\ \hline
\hline
\end{tabular}
\end{center}
}

}

\end{poster}
\end{document}


A couple of brief off-topic points: \headerbox was replaced by \posterbox since 2011, although backwards compatibility still allows it to be used. I was surprised to discover in my testing that the correct colours were also enabled by \selectcolormodel{rgb}, even when the colours were specified in HTML. I guess this is related to xcolor converting HTML to rgb.

(Note: This is bad practice so don't do it, but this could help if you're further investigating the problem.)

I had this problem too. The colors were bugged even when I chose to represent them in CMYK. To solve it, I replaced the line

\RequirePackage[cmyk]{xcolor}


with the line

\RequirePackage[usenames,dvipsnames]{xcolor}


in the baposter.cls file and the colors returned to normal (and now I can use more color names).

• I know it's a bad idea in general and I did not give it a new name, but I decided to answer in case this one-time fix helped anyone else. – Jake Apr 26 '16 at 20:23
• @Jake, if you recommend to 1) copy the content of baposter.cls to a new file, 2) save it under a different name (e.g. mymodifiedbaposter.cls), and finally 3) do the change you proposed, then this is not bad practice. The problem with the current way is, that if you compile the document on another computer, it won't work as you'd have to change the .cls there too. Or somebody updates baposter.cls and suddently it doesn't work anymore. – hbaderts Jul 29 '16 at 5:29