我想画一个正 21 多边形,其中边缘用不同颜色标记,中间有箭头。这是我目前所做的 使用此代码
\documentclass[margin=0pt]{standalone}
%---------------------------- Tikz Libraries ------------------------------%
\usepackage{ifthen}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{decorations, decorations.markings}
\usetikzlibrary{arrows, arrows.meta}
%========================== Middle & pointing arrows ==========================%
%-------------------------------------------------------------------------------%
% usage: \draw[->-] or \draw[->-=6pt red 1]
%-------------------------------------------------------------------------------%
\tikzset{ ->-/.style args={#1 #2 #3}{
decoration={markings,mark= at position 0.5 with {\arrow{stealth}}, },
postaction={decorate}, },
->-/.default= {0.5 6pt black }}
%========================== Middle & pointing arrows ==========================%
%-------------------------------------------------------------------------------%
% usage: \draw[-<-] path; or \draw[-<-=6pt red 1] path;
%-------------------------------------------------------------------------------%
\tikzset{ -<-/.style args={#1 #2 #3}{
decoration={markings,mark= at position 0.5 with {\arrow[>=stealth]{<}}, },
postaction={decorate}, },
-<-/.default= {0.5 6pt black }}
\begin{document}
\begin{tikzpicture}
\node[fill=gray!10] (pol) [
draw,
minimum size=0.9\textwidth,
regular polygon, regular polygon sides=21,
rotate=270,
]{};
\foreach \x/\y/\i in {1/2/1,5/6/2,9/10/3} %\alpha's
\path[red,auto=right, ->-]
(pol.corner \x)--(pol.corner \y)
node[red,midway]{$\alpha_{\i}$};
\foreach \x/\y/\i in {3/4/1,7/8/2,11/12/3} %inverse \alpha's
\path[red,auto=right, -<-]
(pol.corner \x)--(pol.corner \y)
node[red,midway]{$\alpha_{\i}$};
\foreach \x/\y/\i in {2/3/1,6/7/2,10/11/3} %\beta's
\path[blue,auto=right, ->-]
(pol.corner \x)--(pol.corner \y)
node[blue,midway]{$\beta_{\i}$};
\foreach \x/\y/\i in {4/5/1,8/9/2,12/13/3} %inverse \beta's
\path[blue,auto=right, -<-]
(pol.corner \x)--(pol.corner \y)
node[blue,midway]{$\beta_{\i}$};
\foreach \x/\y/\i in {13/14/1, 16/17/2,19/20/3} %\xi's
\path[teal,auto=right,->-]
(pol.corner \x)--(pol.corner \y)
node[teal,midway]{$\xi_ {\i}$};
\foreach \x/\y/\i in {15/16/1,18/19/2,21/1/3} %inverse \xi's
\path[teal,auto=right,-<-]
(pol.corner \x)--(pol.corner \y)
node[teal,midway]{$\xi_{\i}$};
\foreach \x/\y/\i in {14/15/1,17/18/2,20/21/3} %\rho's
\path[violet,auto=right,->-]
(pol.corner \x)--(pol.corner \y)
node[violet,midway]{$\rho_{\i}$};
\end{tikzpicture}
\end{document}
现在,我还想为与标签对应的多边形边缘着色。但我只能将所有边缘涂成相同的颜色。我该怎么做?