# Can I have a glow around a box in TikZ?

What I was wondering is, if I can have a glow effect for a box I am drawing with TikZ. Neither search here nor the (excellent) TikZ manual returned any results. There is a circular glow option, but I don't think that helps in my case, or does it!?

Any input is appreciated :).

Edit: I figured that these blurred shadows seem to be a fairly special PDF feature which is supported by few PDF viewers only (actually Acrobat Reader 9 for Linux was the only one that worked for me).

(size of the blue box is the same)

-
I think the circular glow is exactly what you want. It's just a matter of defining the correct color for it. Perhaps you would need to apply some fading, but otherwise it seems good. – Roelof Spijker Jan 30 '12 at 16:25
I see some glows in How can we display fireworks? – Werner Jan 30 '12 at 16:42
@Werner: Yes, but they are all circular glows. This question is about having a glow around a box [rectangle]. – Peter Grill Jan 30 '12 at 17:46
This is seemingly only possible if you know PostScript coding (which I don't) then you can use \pgfdeclarefunctionalshading. I tried a little but I can't modify the colors (e.g. stuck at yellow). – percusse Jan 31 '12 at 2:20
Don;t be fooled by the name circular glow. It works just as well on a rectangle: \tikz\node[circular glow={fill=red}, fill=blue] {x}; works fine. – Roelof Spijker Jan 31 '12 at 8:47

This MWE is probably closer to your question:

    \documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
%
\fill[inner color=red,outer color=red!10!white] ($(#1.south west)$) circle (\shadowradius);
\fill[inner color=red,outer color=red!10!white] ($(#1.north west)$) circle (\shadowradius);
\fill[inner color=red,outer color=red!10!white] ($(#1.south east)$) circle (\shadowradius);
\fill[inner color=red,outer color=red!10!white] ($(#1.north east)$) circle (\shadowradius);
\fill[ top color=red, bottom color=red!10!white] ($(#1.south west)+((0,-\shadowradius)$) rectangle ($(#1.south east)$);
\fill[left color=red,right color=red!10!white] ($(#1.south east)$) rectangle ($(#1.north east)+((\shadowradius,0)$);
\fill[bottom color=red,top color=red!10!white] ($(#1.north west)$) rectangle ($(#1.north east)+((0,\shadowradius)$);
\fill[right color=red,left color=red!10!white] ($(#1.south west)$) rectangle ($(#1.north west)+(-\shadowradius,0)$);
\end{pgfonlayer}
}
%
\begin{tikzpicture}
\node [fill=blue,rectangle,rounded corners=0pt,draw=blue, ultra thick, text=white] (box) {Test!!!};
\end{tikzpicture}
\end{document}


-
It is indeed. Thank you! – Johannes Feb 6 '12 at 14:58

By modifying the Caramdir's code in this thread: Faded drop-shadow using tikz-based rounded rectangle?, I got this:

Here my MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
%
\fill[inner color=blue,outer color=blue!10!black] ($(#1.south west)$) circle (\shadowradius);
\fill[inner color=blue,outer color=blue!10!black] ($(#1.north west)$) circle (\shadowradius);
\fill[inner color=blue,outer color=blue!10!black] ($(#1.south east)$) circle (\shadowradius);
\fill[inner color=blue,outer color=blue!10!black] ($(#1.north east)$) circle (\shadowradius);
\fill[ top color=blue, bottom color=blue!10!black] ($(#1.south west)+((0,-\shadowradius)$) rectangle ($(#1.south east)$);
\fill[left color=blue,right color=blue!10!black] ($(#1.south east)$) rectangle ($(#1.north east)+((\shadowradius,0)$);
\fill[bottom color=blue,top color=blue!10!black] ($(#1.north west)$) rectangle ($(#1.north east)+((0,\shadowradius)$);
\fill[right color=blue,left color=blue!10!black] ($(#1.south west)$) rectangle ($(#1.north west)+(-\shadowradius,0)$);
\end{pgfonlayer}
}
%