陰影繪製改變顏色

陰影繪製改變顏色

為什麼\shadedraw顏色會變成青色\shadedraw

\documentclass[tikz]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\usepackage{tikz}
\usetikzlibrary{calc, shapes.arrows}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
    
\def\ccolor{cyan}

\begin{tikzpicture}
\draw[fill=\ccolor] (0,0) rectangle ++(2,3);

\shadedraw[top color=\ccolor, bottom color=white, draw=black] (3,0) rectangle ++(2,3);
\end{tikzpicture}


\end{document}

給出:

在此輸入影像描述

謝謝!

答案1

cyan您可以按照您想要的方式定義自己的

\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\definecolor{cyan}{RGB}{0, 255, 255}
\draw[fill=cyan] (0,0) rectangle ++(2,3);
\shadedraw[top color=cyan, bottom color=white, draw=black] (3,0) rectangle ++(2,3);
\end{tikzpicture}
\end{document}

或者您可以在整個文件中使用 RGB 顏色模型

\documentclass[tikz, rgb, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[fill=cyan] (0,0) rectangle ++(2,3);
\shadedraw[top color=cyan, bottom color=white, draw=black] (3,0) rectangle ++(2,3);
\end{tikzpicture}
\end{document}

兩個青色矩形,其中一個有陰影

- 或 CMYK 模型\documentclass[tikz, cmyk, border=1cm]{standalone}

兩個深青色矩形,其中一個有陰影

相關內容