I want to use hsb color model to shading.
First rectangle shows a shading using rgb color model.
Second rectangle shows a shading using hsb color model. But I don't understand why I don't obtain the same shading that with my third rectangle.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% create some hsb colors
\colorlet{redhsb}[hsb]{red}%
\colorlet{bluehsb}[hsb]{blue}%
\colorlet{greenhsb}[hsb]{green}%
% first shading with rgb color model
\fill[left color=red,right color=blue] (0,1) rectangle (2,0);
% second shading with hsb color model
\fill[left color=redhsb,right color=bluehsb] (0,0) rectangle (2,-1);
% third shading with hsb color model
\fill[left color=redhsb,right color=greenhsb] (0,-1) rectangle (1,-2);
\fill[left color=greenhsb,right color=bluehsb] (1,-1) rectangle (2,-2);
\end{tikzpicture}
\end{document}
Edit: In fact, TikZ calculates the middle color (using color model of the left color). Then, it converts all three colors to rgb model and make shading...
I add a fourth rectangle:
% fourth shading with rgb color model
\fill[left color=red,right color=green] (0,-2) rectangle ++(1,-1);
\fill[left color=green,right color=blue] (1,-2) rectangle ++(1,-1);
So, my question is: Can TikZ do real hsb (HSV) shading?
a->b
is not the same as fora->c->b
. You can test this by only making your second and third colorsrgb
again. – percusse Jun 9 '12 at 17:52tikz
maps HSL to RGB. – Count Zero Jun 9 '12 at 19:38