0

Is it possible to get a background effect for the path child of a mindmap by making adaptations in the code below? I intend to be able to apply the background effect on the arm that connects the parent node "Sky" to the child node "Tree" as intended in my own question. In the end, what I have in mind is that it looks something like this: child {node [concept, background] {Tree}} ..... Other libraries or keys may be used instead of background as long as you can apply the solution immediately on the way. Principle of thinking: replace edge by node or Creating TiKz libraries or adapting?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,automata,backgrounds,mindmap}
\definecolor{light-gray}{gray}{0.6}
\makeatletter
\def\tikz@@nodetoparent[#1]{%
  \let\tikz@node@to@parent@needed=\pgfutil@empty%
  \tikz@node@is@a@labeltrue%  
\begingroup
    \tikzset{node from parent,#1}%
    \ifpgf@node@background
      \edef\pgf@next{\noexpand\edef\noexpand\pgf@linewidth{\the\pgflinewidth}\noexpand\pgfutil@firstoftwo}
    \else
      \def\pgf@next{\pgfutil@secondoftwo}
    \fi
    \pgfmath@smuggleone\pgf@next
  \endgroup
  \pgf@next{\pgfonlayer{background}\path[style=node ,line width/.expanded=\pgf@linewidth,#1] \tikz@node@topath;\endpgfonlayer\tikz@scan@next@command}%
  {\tikz@scan@next@command [style=node,#1] \tikz@node@topath}%
}
\newif\ifpgf@node@background
\tikzset{background node/.is if=pgf@node@background}
\makeatother

\begin{document}
\begin{tikzpicture}[mindmap]
    \centering
    \tikzset{every node/.style={text width=2cm,minimum size=5cm}}
 \node [concept, text=blue!50!black!10,align=center] at (0,0) 
      {\Huge Floor} 
child [background node, concept color=blue!50, grow=-90,level distance=412,on background layer]
    {node [concept] (sky) {\Huge Sky}
child [concept color=black!20!yellow!20!red!30!blue!10!green!30,grow=240,level distance=210]
    {node [scale=0.9,concept] {\Huge BIRD'S TO..}}
child [concept color=black!20!yellow!20!red!30!blue!10!green!30,grow=240,level distance=410]
    {node [scale=0.9,concept] {\Huge Tree.}}
    };
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.