跳至主要內容
PGF 使用 Shadings Library 绘制渐变色时颜色不一致

问题描述

在使用 PGF 的 Shadings Library 绘制渐变色时,有时会出现颜色不一致的问题。MWE 如下:

\documentclass{minimal}

\usepackage{color}
\usepackage{tikz}
\usepgflibrary{shadings}

\newcommand{\testikzcolor}[1]{
	\texttt{#1}
	& \hspace{1em}
	\begin{tikzpicture}
		\draw[fill=#1] (0,0) rectangle (1,1);
		\draw[top color=#1,bottom color=#1] (1,0) rectangle (2,1);
	\end{tikzpicture}
	\\
}

\begin{document}

\begin{tabular}{rl}
	\testikzcolor{black}
	\testikzcolor{red}
	\testikzcolor{green}
	\testikzcolor{blue}
	\testikzcolor{white}
	\testikzcolor{cyan}
	\testikzcolor{magenta}
	\testikzcolor{yellow}
\end{tabular}

\end{document}

Bob Yue小于 1 分钟排版LaTeXPGF / TikZ