0

I'm trying to make a color series with the xcolor package in order to carry out what I want in this question. However, it seems as though you can only choose a start and end color, and have a color gradation in between them. This does not leave any room for defining a completely custom color series where the colors don't have a particular order (if someone knows of a cool tool which can create a complicated gradation formula for any sequence of colors you throw to it, that would also be cool, but I think that's quite unlikely).

So I just want to know if there is a way to create a custom color sequence with my own colors. Or maybe if I can link together multiple bicolor sequences together to achieve something of this effect. It seems as though the perfect way I can create a color palette as per the linked question is by using this feature of xcolor – though unfortunately it seems to only work for colors which show a gradation, and doesn't let you define colors 1, 2, 3, etc. If anyone is interested, here is the documentation for xcolor's color series, on page 25. It doesn't seem to say anything about what I want.

6
  • I'm not clear what you really want, even with the original colour package without the xcolor extensions you could define 100 arbitrary colours c1 .. c100 and then arrange to use the appropriate colour given an input value. May 18 '17 at 20:43
  • Haha you made the color package? Well, I skimmed through the documentation and googled "LaTeX arrange colors," but I can't find anything... is there an example anywhere I can look at? May 18 '17 at 20:55
  • I've been searching for a while, but I honestly can't find anything which will change the color depending on the input value. No amount of googling gives me anything! Is this a more obscure feature? May 18 '17 at 21:20
  • so that would be an answer say 10 arbitrary colours that you could pick as 1 to 10? May 18 '17 at 21:45
  • Yes, that would... though if they can be assigned to different sections. I don't know if you looked at the linked question (you probably did) but that's just the effect I'm trying to achieve May 18 '17 at 21:47
3

Something like this if I understand correctly

enter image description here

\documentclass{article}

\usepackage{color}

\definecolor{zz0}{rgb}{.1,.8,.3}
\definecolor{zz1}{rgb}{.8,.2,.2}
\definecolor{zz2}{rgb}{.7,.9,.1}
\definecolor{zz3}{rgb}{.6,.4, 0}
\definecolor{zz4}{rgb}{.5,.1,.9}
\definecolor{zz5}{rgb}{.1, 0,.8}
\definecolor{zz6}{rgb}{.7,.2,.6}
\definecolor{zz7}{rgb}{.9,.3,.8}
\definecolor{zz8}{rgb}{0 ,.4,.1}
\definecolor{zz9}{rgb}{.7,.5,.2}
\definecolor{zz10}{rgb}{.1,.6,.3}
\definecolor{zz11}{rgb}{.6,.8,.5}

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries\color{zz\arabic{section}}}}
\makeatother

\begin{document}

\section{Hmmmm}
zzz
\section{Hmmmm}
zzz
\section{Hmmmm}
zzz
\section{Hmmmm}
zzz
\section{Hmmmm}
zzz


\end{document}
3
  • Hmmm... how do you even come up with this stuff? Well, I'll admit that I was almost close to redefining the section command, but I had no idea how to make an array of colors. Thanks. May 18 '17 at 22:34
  • @SkeletonBow there are no internal commands here apart from the definition of section which is just copied from article.cls with \color{..} added (you could instead use a package such as titlesec etc if you prefer) \definecolor{zz10}{rgb}{.1,.6,.3} is just the standard command to define a colour with name zz10 it isn't really an array as such just a colour of that name. May 18 '17 at 22:44
  • Yes, I see, thanks! This answers the question :). Unfortunately it doesn't work wth the header and subsections according to the section number, but that's something else :) May 19 '17 at 11:51

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.