[Tex/LaTex] Tree edges different coloring

tikz-pgftikz-stylestikz-trees

I want to make tree with each node has valency of three. I got the below code online somewhere. The first level has valency three however second and third level has valency four, and I also want to color the child different from parent and just want to use three colors. (e.g if parent is red then the branches will be green and blue)

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{trees,snakes}
\begin{document}
\pagestyle{empty}
\tikzstyle{level 1}=[level distance= 32mm,sibling angle=120]
\tikzstyle{level 2}=[level distance= 16mm,sibling angle=60]
\tikzstyle{level 3}=[level distance = 12mm,sibling angle=30]
\tikzstyle{every node}=[fill]
%\tikzstyle{edge from parent}=[segment length=1mm,
%                              segment angle=10,draw]
\begin{tikzpicture}[grow cyclic,shape=circle,very thick,level distance=13mm,
                    cap=round]
\node {} child [color=\A] foreach \A in {red,green,blue}
    { node {} child [color=\A!50!\B] foreach \B in {red, green,blue}
        { node {} child [color=\A!50!\B!50!\C] foreach \C in {red,green,blue}
            { node {} }
        }
    };
\end{tikzpicture}

enter image description here

I am new in using tikz and didn't feel comfortable in working with it so far.

Best Answer

Very similar to Andrew's nice answer except that parents and children have different colors. EDIT: removed a superfluous \index, big thanks to Andrew! @nd EDIT: Simplification with \pgfkeysalso.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{trees,snakes}
\begin{document}
\pagestyle{empty}
\xdef\mycolor{black}
\xdef\ColorList{{"red","green!60!black","blue"}}
\tikzset{level 1/.style={level distance= 32mm,sibling angle=120},
level 2/.style={level distance= 16mm,sibling angle=60},
level 3/.style={level distance = 12mm,sibling angle=30},
every node/.append style={fill},
my color/.code={\pgfmathparse{\ColorList[mod(#1,3)]}
\pgfkeysalso{/tikz/color/.expanded=\pgfmathresult}}}
\begin{tikzpicture}[grow cyclic,shape=circle,very thick,level distance=13mm,
                    cap=round]
\node {} child [my color=\A] foreach \A in {0,1,2}
    { node {} child [my color=\A+\B+1] foreach \B in  {0,1}
        { node {} child [my color=\A+\B+\C+2] foreach \C in  {0,1}
            { node {} }
        }
    };
\end{tikzpicture}
\end{document}  

enter image description here