4

I'm trying to use the wave color model in a tikz picture using the document class article. When I do, I get the error message "Unsupported color model 'hsb'". Consider the code below.

\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}

\definecolor{MyColor}{wave}{500}

\begin{document}

\textcolor{MyColor}{Hello}

\begin{tikzpicture}

\node[fill=MyColor, circle](1) at (0,0){};
\node[fill=red, circle](2) at (2,0){};
\node[fill={rgb:red,1;green,0;blue,1}, circle](3) at (4,0){};

\end{tikzpicture}

\end{document}

This produces

enter image description here

with the error message written above. Notice that the defined color MyColor works fine in text, but not in tikz. Also notice that tikz does support the rgb color model.

If I change the document class to beamer, with the option xcolor={rgb}, then I get

enter image description here

If I try to add the option xcolor={rgb} to the document class article, the code won't compile.

Is there a work-around to being able to use the wave color model inside of a tikz picture using the article document class?

6

Using the rgb option as package option to xcolor:

\usepackage[rgb]{xcolor}

or, passing it as a global option, to be picked up by xcolor, as in

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

seem to work both in beamer and in article. A little example:

\documentclass{article}
\usepackage[rgb]{xcolor}
\usepackage{tikz}

\definecolor{MyColor}{wave}{500}
\definecolor{MyColori}{wave}{450}

\begin{document}

\textcolor{MyColor}{Hello}

\textcolor{MyColori}{Hello}

\begin{tikzpicture}
\node[fill=MyColor, circle](1) at (0,0){};
\node[fill=red, circle](2) at (2,0){};
\node[fill={rgb:red,1;green,0;blue,1}, circle](3) at (4,0){};
\node[fill=MyColori, circle](1) at (6,0){};
\end{tikzpicture}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.