答案1
取决于你所说的“颜色混合”到底是什么意思。你可以使用path fading
(参见这个答案)例如实现
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fadings,shadings}
\usepackage{fontawesome5}
\newcommand{\ShadeChar}[2][]{%
\begin{tikzfadingfrompicture}[name=temp]
\node[transparent!0] {#2};
\end{tikzfadingfrompicture}%
\tikz[baseline=(X.base)]{\node[inner sep=0pt,outer sep=0pt] (X)
{\phantom{#2}};
\path[path fading=temp,fit fading=false,overlay,#1] (X.south west) rectangle
(X.north east);}%
}
\begin{document}
\ShadeChar[upper left=red,lower right=blue]{\faVolleyballBall}
\begin{tikzfadingfrompicture}[name=temp]
\node[transparent!0] {\faVolleyballBall};
\end{tikzfadingfrompicture}%
\tikz[baseline=(X.base)]{\node[inner sep=0pt,outer sep=0pt] (X)
{\phantom{\faVolleyballBall}};
\path[path fading=temp,fit fading=false,overlay,fill=red]
(0:1em) arc(0:120:1em) to[bend left=20] (0,0) to[bend right=20] cycle;
\path[path fading=temp,fit fading=false,overlay,fill=blue]
(120:1em) arc(120:240:1em) to[bend left=20] (0,0) to[bend right=20] cycle;
\path[path fading=temp,fit fading=false,overlay,fill=green!70!black] (240:1em) arc(240:360:1em)
to[bend left=20] (0,0) to[bend right=20] cycle;}%
\end{document}
正如您在第二个示例中看到的,需要进行一些调整,因为此技巧仅允许您对整个字符进行着色,而对字符的单个补丁一无所知。其他软件包(如 asymptote 或 pstricks)允许您检索字形的轮廓路径,并将它们用于填充等。