11.3 LaTeX 配色

LaTeX 宏包 xcolor 中定义颜色的常用方式有两种,其一,\textcolor{green!40!yellow} 表示 40% 的绿色和 60% 的黄色混合色彩,其二,\textcolor[HTML]{34A853} HEX 表示的色彩直接在 LaTeX 文档中使用的方式,类似地 \textcolor[RGB]{52,168,83} 也表示 Google 图标中的绿色。

\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (2,1) node [midway] {\textcolor[RGB]{52,168,83}{Hello} \textcolor[HTML]{34A853}{\TeX}};
\end{tikzpicture}
\end{document}

对应于 R 中的调用方式为:

rgb(52, 168, 83, maxColorValue = 255)
## [1] "#34A853"