I want to draw a line with a shade, not a big rectangle.
As per the documentation,
Shading is caused by the shade option (there are \shade and \shadedraw abbreviations).
Shouldn't therefore something like this work?
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw [shade, left color=red, right color=blue] (0,0) -- (1,0);
\end{tikzpicture}
\end{document}
But I cannot get it to be shaded. It always shows up like this:
In actuality, what I want to draw is a rectangle where the end of the borders are shaded this way:
There is probably a simple way to do this, but I only see forms of doing filled shade, not border shades or single lines…
Best Answer
You can use
path fading
fromfadings
library.