# Coloring components and customizing voltages in circuitikz

I have the next code:

\begin{center}
\begin{circuitikz}[american,thick]
\ctikzset{bipoles/thickness=2}
\draw (0,0) to [R = $R$,i=$i_f$,v=$v_R$] (4,0);
\draw (4,0) to [empty led,v=$v_{LED}$](8,0);
\draw (8,0) -- (8,-0.5) node[ground]{};
\end{circuitikz}
\end{center}


Given as result this:

And what I want to obtain is what I show in red in the next picture:

1. The +5V label (in black).
2. The voltage indicators are also in black but are quite separate from the element in question.
3. Fill the LED color in red.

• I could give it a shot, but you should consider changing the title. Think about someone having the same problem you have --- that title means nothing! How about "How to add arrow voltages and color components in circuitikz"? Can you see that this way it will be much more useful for other users? Or a similar thing --- the title must be searchable. Oct 2 '20 at 14:58
• And BTW, those are 2 questions ;-) Oct 2 '20 at 14:59
• Why do you use american if you want european voltage markers? Oct 2 '20 at 15:00
• Hope you don't mind the change of title. More searchable now Oct 2 '20 at 15:59
• @AlejandroFernandezSuarez-- if the answer meets the requirement request accept by clicking the green tick mark on the left side Oct 3 '20 at 16:49

The first requirement

\documentclass[11pt]{article}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}[american,thick]
\ctikzset{bipoles/thickness=2}
\draw [short,o-](0,0) to [R = $R$,i=$i_f$,v=$v_R$] (4,0);
\draw (4,0) to [empty led,v=$v_{LED}$](8,0);
\draw (8,0) -- (8,-0.5) node[ground]{};

\node[left=1cm] (node name) {+5V};
\end{circuitikz}

\end{document}


Second requirement

\documentclass[11pt]{article}
\usepackage{circuitikz}
\usetikzlibrary{calc, positioning}

\begin{document}
\begin{circuitikz}[american,thick]
\ctikzset{bipoles/thickness=2}
\draw [short,o-](0,0) to [R = $R$,i=$i_f$,v=$v_R$, name=r] (4,0);
\draw (4,0) to [empty led,v=$v_{LED}$](8,0);
\draw (8,0) -- (8,-0.5) node[ground]{};

\node[left=1cm] (node name) {+5V};
\draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=1.2] ($(r.east)+(0.5,0)$) to ($(r.west)+(-0.5,0)$);
\end{circuitikz}

\end{document}


Third requirement

\documentclass[11pt]{article}
\usepackage{circuitikz}
\usetikzlibrary{calc, positioning}

\begin{document}
\begin{circuitikz}[american,thick]
\ctikzset{bipoles/thickness=2}
\draw [short,o-](0,0) to [R = $R$,i=$i_f$,v=$v_R$, name=r] (4,0);
\draw (4,0) to [empty led,v=$v_{LED}$, name=led](8,0);
\draw (8,0) -- (8,-0.5) node[ground]{};

\node[left=1cm] (node name) {+5V};
\draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=1.2] ($(r.east)+(0.5,0)$) to ($(r.west)+(-0.5,0)$);

\draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=2.3] ($(led.east)+(0.5,0)$) to ($(led.west)+(-0.5,0)$);
\end{circuitikz}

\end{document}


Fourth requirement

\documentclass[11pt]{article}
\usepackage{circuitikz}
\usetikzlibrary{calc, positioning}

\begin{document}
\begin{circuitikz}[american,thick]
\ctikzset{bipoles/thickness=2}
\draw [short,o-](0,0) to [R = $R$,i=$i_f$,v=$v_R$, name=r] (4,0);
\draw (4,0) to [empty led,v=$v_{LED}$, name=led, fill=red](8,0);
\draw (8,0) -- (8,-0.5) node[ground]{};

\node[left=1cm] (node name) {+5V};
\draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=1.2]
($(r.east)+(0.5,0)$) to ($(r.west)+(-0.5,0)$);

\draw[red,rounded corners=0.2cm,-latex, out=260,in=280,looseness=2.3]
($(led.east)+(0.5,0)$) to ($(led.west)+(-0.5,0)$);
\end{circuitikz}

\end{document}


If you use the correct options, this is the basic output that come with circuitikz:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[american,thick]
\ctikzset{bipoles/thickness=2, voltage=european}
\draw (0,0) node[left]{\SI[retain-explicit-plus]{+5}{\volt}}
to [R = $R$,i=$i_f$,v=$v_R$, o-] (4,0);
\draw (4,0) to [empty led,fill=red, v=$v_{LED}$](8,0);
\draw (8,0) -- (8,-0.5) node[ground]{};
\end{circuitikz}
\end{document}


You can change the appearance of the arrow using several parameters (see in the manual) or, if you really want a very different look, using advanced voltages (they are experimental, but more or less they work).

To move away the voltages, you can just use the parameter bump b (manual page 142).

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[american,thick]
\ctikzset{bipoles/thickness=2, voltage=european}
\draw (0,0) node[left]{\SI[retain-explicit-plus]{+5}{\volt}}
to [R = $R$,i=$i_f$,v=$v_R$, voltage/bump b=3.5, o-] (4,0);
\draw (4,0) to [empty led,fill=red, v=$v_{LED}$, voltage/bump b=2.5](8,0);
\draw (8,0) -- (8,-0.5) node[ground]{};
\end{circuitikz}
\end{document}


If you really want the voltages under the arrow, a different color, etc, you have to take full responsibility to draw the arrows (see manulal page 153, "advanced voltages...")

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[american,thick]
\ctikzset{bipoles/thickness=2, voltage=european}
\draw (0,0) node[left]{\SI[retain-explicit-plus]{+5}{\volt}}
to [R = $R$,i=$i_f$,l_=$v_R$, v, name=myr, o-] (4,0);
\draw (4,0) to [empty led,fill=red, l_=$v_{LED}$, v, name=myled](8,0);
\draw (8,0) -- (8,-0.5) node[ground]{};
\draw [-Triangle, red] ([yshift=-0.5cm]myled-Vfrom) to[out=-120, in=-60] ([yshift=-0.5cm]myled-Vto);
\draw [-Triangle, red] ([yshift=-0.5cm]myr-Vfrom) to[out=-120, in=-60] ([yshift=-0.5cm]myr-Vto);
\end{circuitikz}
\end{document}