5

I'm using the smartdiagram package to draw a diagram, and I'm using additionals.

I would like use different fill colors for each of the additionals, but so far I couldn't figure out if this is possible.

Here is my MWE, where all the additionals are filled with gray!20

\documentclass{article}
\usepackage{tikz}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions} 

\begin{document}

\centering
\smartdiagramset{
    set color list={red!10, red!30,red!50},
    sequence item border color=black,
    sequence item text color=black,
    sequence item border size=1.2\pgflinewidth,
    sequence item font size=\scriptsize\sffamily,
    additions={
        additional item shape=rectangle,
        additional item fill color=gray!20,
        additional item border color=black,
        additional arrow line width=2pt,
        additional arrow tip=to,
        additional arrow color=black,
        additional item font=\scriptsize\sffamily,
      }
}
\smartdiagramadd[sequence diagram]{step 1,step 2, step 3}
{above of sequence-item1/input,below of sequence-item2/output 1,below of sequence-item3/output 2}
\smartdiagramconnect{to-}{sequence-item1/additional-module1}
\smartdiagramconnect{-to}{sequence-item2/additional-module2}
\smartdiagramconnect{-to}{sequence-item3/additional-module3}

\end{document}

enter image description here

Is there any way of using different fill colors for annotations "input", "output 1" and "output 2"?

lorenae
  • 75

1 Answers1

5

You could use a colorseries directly. For example:

\documentclass{article}
\usepackage[rgb]{xcolor}
\usepackage{tikz}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}
% xcolor manual: 34
\definecolorseries{colours}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}
\resetcolorseries[12]{colours}

\begin{document}

\centering
\smartdiagramset{
    set color list={red!10, red!30,red!50},
    sequence item border color=black,
    sequence item text color=black,
    sequence item border size=1.2\pgflinewidth,
    sequence item font size=\scriptsize\sffamily,
    additions={
        additional item shape=rectangle,
        additional item fill color=colours!!+!20,
        additional item border color=colours!!,
        additional arrow line width=2pt,
        additional arrow tip=to,
        additional arrow color=black,
        additional item font=\scriptsize\sffamily,
      }
}
\smartdiagramadd[sequence diagram]{step 1,step 2, step 3}
{above of sequence-item1/input,below of sequence-item2/output 1,below of sequence-item3/output 2}
\smartdiagramconnect{to-}{sequence-item1/additional-module1}
\smartdiagramconnect{-to}{sequence-item2/additional-module2}
\smartdiagramconnect{-to}{sequence-item3/additional-module3}

\end{document}

colour series for additional modules

cfr
  • 198,882
  • thanks @cfr. What if I need to use specific colors, for example ("yellow", "gray", "gray"). This kind of collections are not easy to obtain via \definecolorseries. – lorenae Jul 20 '16 at 14:11
  • @lorenae Well, you didn't say so before. You just asked for different colours i.e. not all the same, so that's the question I answered! – cfr Jul 20 '16 at 16:55
  • yes @cfr, my fault. I should have been more specific on that. Any clue on how to accomplish this? I've tried to use the rationale behind your solution (defining a list of the specific colors I need and iterate over it) but I don't know how to do it. – lorenae Jul 21 '16 at 02:54
  • @lorenae No, sorry. My solution relies on the fact that for a colour series, you can use the special syntax from xcolor to both call the colour and change the colour to the next one in the series. But I don't see a straightforward way to specify the colours in a series explicitly. I guess to implement a loop, you'd have to figure out a way to adapt smartdiagram rather than looking at the colours. – cfr Jul 21 '16 at 12:06