\documentclass[tikz,border=5pt,multi]{standalone}
\usepackage{forest,array}
\usetikzlibrary{shadows}
\begin{document}
\newcolumntype{C}[1]{>{\centering}p{#1}}
\begin{forest}
for tree={
if level=0{align=center}{% allow multi-line text and set alignment
align={@{}C{45mm}@{}},
},
grow=east,
draw,
font=\sffamily\bfseries,
edge path={
\noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) -- +(5mm,0) |- (.child anchor)\forestoption{edge label};
},
parent anchor=east,
child anchor=west,
l sep=10mm,
tier/.wrap pgfmath arg={tier #1}{level()},
edge={ultra thick, rounded corners=2pt},
fill=white,
rounded corners=2pt,
drop shadow,
}
[UML Diagram
[Structure Diagram
[Class Diagram]
[Object Diagram]
[Package Diagram]
[Component Diagram]
[Composite Structure Diagram]
[Deployment Diagram]
[Profile Diagram]
]
[Behaviour Diagram
[Use Case Diagram]
[Activity Diagram]
[State Machine Diagram]
[Interaction Diagram
[Sequence Diagram]
[Communication Diagram]
[Interaction Overview Diagram]
[Timing Diagram]
]
]
]
\end{forest}
\end{document}
如何为父级(级别 1)和孙级(级别 2)分配唯一的颜色/填充。
谢谢