# Color changes of orbitals in chemmacros

I'm trying to change the colors of these orbitals. So instead of the clear and blue color, I want them to be red and blue only. I tried changing the setup color, but just becomes red and clear or blue and clear. How would I change it?

\documentclass{general}

\usepackage{chemfig,chemmacros}
\chemsetup{modules=all}

\begin{document}
\setbondoffset{0pt}
\chemsetup[orbital]{
overlay ,
opacity = .75 ,
p/scale = 1.6 ,
s/color = blue!50 , %changing to red!50 is no help%
s/scale = 1.6
}
\chemfig{
-[:-20]\orbital{p}
(-[:-150])-\orbital{p}
}
\end{document}


It would appear the package default is black and white and the only available option is to change the upper black half to another color tone as you have done to blue.

However we can workaround and trick the package to produce this

without resorting to redefining any package definitions (I do agree its a kludge)

\documentclass[a5paper]{report}
% \documentclass{general} % I do not have a general.sty
\usepackage{chemfig,chemmacros}
\chemsetup{modules=all}

\begin{document}
\setbondoffset{0pt}
\chemsetup[orbital]{
overlay ,
opacity = .75 ,
p/color = blue!50 , %setting black to another color%
p/scale = 1.6
}
\chemfig{
-[:-20]{\orbital[phase=-]{p}}{\orbital[half,color=red!75]{p}} %Note a half does not work well inverted so invert p
(-[:-150])-{\orbital[phase=-]{p}}{\orbital[half,color=red!75]{p}} % and over-strike white half with red half @75%
}
\hspace{12mm}
{  \chemfig{
-[:-20]{\orbital[phase=-]{p}}{\orbital[half,color=red!75]{p}} %Note a half does not work well inverted so invert p
(-[:-150])-{\orbital{p}}{\orbital[half,angle=270,color=red!75]{p}} % and over-strike white half with red half @75%
}
\hspace{12mm}
{  \chemfig{
-[:-20]{\orbital{p}}{\orbital[half,angle=270,color=red!75]{p}}  %Note a half does not work well inverted so invert p
(-[:-150])-{\orbital{p}}{\orbital[half,angle=270,color=red!75]{p}} % and over-strike white half with red half @75%
}
\end{document}

• Thank you for the answer, it was really helpful! How would I do it for the sp2 orbital command? Would it be the same process? @KJO – Dave2343 Mar 5 '19 at 1:32
• I would say "roughly" yes since that is the way the package appears to be constructed (I did not look into wrestling with the code, just at how to simply work within its limitations) I suspect scaling will be the bigger part of adjusting for sp2 but once you have the relative scales correct once it is then simply a bigger volume of cut and paste. Thinking about it for sp2 it would be easier to just have the 2 scaled coloured halves of P and not use sp2 at all – user170109 Mar 5 '19 at 1:38
• Oh ok. Then I'll try that out. Thanks! – Dave2343 Mar 5 '19 at 1:40