4

I'm trying to make a sphere in cmyk colours. In rgb, the spheres are nicely overlapping as expected. Is the solution using @Christian Feuersänger suggestion here?

\documentclass{standalone}
\usepackage{xcolor,tikz}
\definecolor{greyR}{RGB}{102,102,102}
\definecolor{darkR}{RGB}{75,75,75}
\definecolor{darkC}{cmyk}{0,0,0,.80}
\definecolor{greyC}{cmyk}{0,0,0,.70}
% Define shading (RGB)
\pgfdeclareradialshading{sphereR}{\pgfpoint{-0.2cm}{0.35cm}}{%
color(0cm)=(white);
color(0.7cm)=(greyR);
color(0.85cm)=(darkR)
}
% Define shading (CMYK)
\pgfdeclareradialshading{sphereC}{\pgfpoint{-0.2cm}{0.35cm}}{%
color(0cm)=(white);
color(0.7cm)=(greyC);
color(0.85cm)=(darkC)
}
\newcommand*{\myBallR}[3]{\fill [shading=sphereR,darkR] (#1,#2) circle (1cm) node[black] {rgb};}
\newcommand*{\myBallC}[3]{\fill [shading=sphereC,darkC] (#1,#2) circle (1cm) node[black] {cmyk};}
\begin{document}
\begin{tikzpicture}
\draw [fill=darkR] node[black,above=-3pt] {\footnotesize rgb} (-2cm, 0cm) rectangle (2cm,2cm)  ;
\draw [fill=darkC] node[black,below=-3pt] {\footnotesize cmyk} (-2cm,-2cm) rectangle (2cm,0cm);
\myBallR{.98}{.98};
\myBallR{.98}{-.98};
\myBallC{-.98}{.98};
\myBallC{-.98}{-.98};
\end{tikzpicture}
\end{document}

enter image description here

6

As you are aware, pgf only supports shadings in RGB. But it is now possible to output shadings in CMYK and grayscale using a new package, pgf-cmykshadings.

pgf-cmykshadings should be loaded before tikz to ensure the tikz shadings are set up to allow for output in the CMYK colour space.

MWE

This MWE follows the question and shows both RGB and CMYK spheres. In a real world document you would probably want to force all colours everywhere to be CMYK by loading xcolor with the cmyk option and not changing the colour model.

\documentclass{standalone}
\usepackage{pgf-cmykshadings}
\usepackage{tikz}
\definecolor{greyR}{RGB}{102,102,102}
\definecolor{darkR}{RGB}{75,75,75}
\definecolor{darkC}{cmyk}{0,0,0,.80}
\definecolor{greyC}{cmyk}{0,0,0,.70}
% Define shading (RGB)
\selectcolormodel{rgb} % select the RGB colour model to define an RGB shading
\pgfdeclareradialshading{sphereR}{\pgfpoint{-0.2cm}{0.35cm}}{%
color(0cm)=(white);
color(0.7cm)=(greyR);
color(0.85cm)=(darkR)
}
% Define shading (CMYK)
\selectcolormodel{cmyk} % select the CMYK colour model to define a CMYK shading
\pgfdeclareradialshading{sphereC}{\pgfpoint{-0.2cm}{0.35cm}}{%
color(0cm)=(white);
color(0.7cm)=(greyC);
color(0.85cm)=(darkC)
}
\selectcolormodel{natural} % return to the natural colour model so we can use both RGB and CMYK colours
\newcommand*{\myBallR}[3]{\fill [shading=sphereR,darkR] (#1,#2) circle (1cm) node[black] {rgb};}
\newcommand*{\myBallC}[3]{\fill [shading=sphereC,darkC] (#1,#2) circle (1cm) node[black] {cmyk};}
\begin{document}
\begin{tikzpicture}
\draw [fill=darkR] node[black,above=-3pt] {\footnotesize rgb} (-2cm, 0cm) rectangle (2cm,2cm)  ;
\draw [fill=darkC] node[black,below=-3pt] {\footnotesize cmyk} (-2cm,-2cm) rectangle (2cm,0cm);
\myBallR{.98}{.98};
\myBallR{.98}{-.98};
\myBallC{-.98}{.98};
\myBallC{-.98}{-.98};
\node at (0,2.2cm) {\textcolor{cyan}{C} \textcolor{magenta}{M}
\textcolor{yellow}{Y} K};
\end{tikzpicture}
\end{document}

Composite output

Note the mismatched shades of grey.

enter image description here

Separations

Note that the CMYK sphere and bottom CMYK background appears only on the black plate, but the RGB spheres and top RGB background separate out onto all four plates.

The separations below were made using the GhostScript tiffsep device.

Cyan Plate

enter image description here

Magenta Plate

enter image description here

Yellow Plate

enter image description here

Black Plate

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.