Here is an approach that, for a couple of reasons, is interesting.
\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}
\newcommand{\makemycolor}[2]{%
\pgfmathsetmacro{\hue}{(#1/100)^1.715*0.8}%
\definecolor{myhsbcolor}{hsb}{\hue,1,1}%
\textcolor{myhsbcolor}{#2}%
}
\begin{document}
\noindent\begin{tikzpicture}
\foreach \k in {0,1,...,100}{%
\pgfmathsetmacro{\hue}{(\k/100)^1.715*0.79}
\definecolor{mycolor}{rgb:hsb}{\hue,1,1}
\node[color=mycolor] () at (\k/10,0) {$\bullet$};
}%
\foreach \f in {0,1,...,10}{%
\pgfmathtruncatemacro{\num}{\f*10}
\node () at (\f,-.5) {\num};
}
\foreach \g/\h in {0/Red,2/Orange,4/Yellow,6/Green,8/Blue,10/Purple}{%
\pgfmathtruncatemacro{\num}{\g*10}
\node at (\g,-1) {\makemycolor{\num}{\h}};
}%
\end{tikzpicture}
\end{document}

First, this uses the hsb
(hue-saturation-brightness) model, as Thruston suggests.
Second: Normally, TikZ
cannot use the hsb
model. That problem is solved by specifying \usepackage[rgb]{xcolor}
which causes xcolor.sty
to convert all colors from whatever color space to the rgb
color space which TikZ
can use. You could also say \usepackage[cmyk]{xcolor}
if you were having this printed -- TikZ
also understands cmyk
. Also note that you could say \usepackage{xcolor}
but define the color with \definecolor{mycolor}{rgb:hsb}{\hue,1,1}
or \definecolor{mycolor}{cmyk:hsb}{\hue,1,1}
-- again this converts hsb to rgb or cmyk, but on an individual basis.
Note that xcolor.sty
must be loaded BEFORE tikz.sty
.
Third, the function that actually sets up what the hue is
\pgfmathsetmacro{\hue}{(\k/100)^1.715*0.8}
can be varied at will to get a better spread of colors. The 0.8
determines the ending color, so you can adjust it a little up or down to fine-tune the shade of purple at the end of the spectrum.
So, for a macro that could be called for a specific color, you could try something like this:
\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}
\newcommand{\makemycolor}[2]{%
\pgfmathsetmacro{\hue}{(#1/100)^1.715*0.79}%
\definecolor{myhsbcolor}{hsb}{\hue,1,1}%
\textcolor{myhsbcolor}{#2}%
}
\begin{document}
\makemycolor{0}{Red}
\makemycolor{40}{Yellow}
\makemycolor{55}{Green with a touch of yellow}
\makemycolor{100}{Purple}
\end{document}

As an aside, you can also specify \usepackage[gray]{xcolor}
in the preamble to get this:

Not sure of the practical use of this, but interesting nonetheless.
xcolor
. Look at its support for the HSB colour model. What you describe is essentially how the "hue" parameter works.