see the following MWE I am trying to find a solution for the following task.

The outer rectangle should start with white color, also the inner one. the rectangle between is only for demonstration purposes and the color should be red.

The area between inner and outer rectangle should be colorized (white - red -white) and the area of the inner rectangle should remain white.

I was playing with pst-grad and pst-slpe but I cannot handle this in a right way.


\usepackage{multido, pst-intersect, pst-tools,multicol}







Any ideas?

1 Answer 1


Here's a TikZ solution. If you need to stick to pstricks, perhaps the same method could be applied there which is, basically, to fill the entire rectangle and to then fill 4 trapeziums to make the borders. (But the borders could be larger than the bit in the middle, of course. This is just how I thought about it.)

    vshade/.style={bottom color=white, top color=white, middle color=red},
    hshade/.style={left color=white, right color=white, middle color=red},
  \fill [white] (-5,-3) coordinate (d) rectangle (5,3) coordinate (b);
  \shade [vshade] (d |- b) coordinate (a) -- (b) -- +(\borderwidth,\borderwidth) coordinate (B) -- (a |- B) -- +(-\borderwidth,0) coordinate (A) -- cycle;
  \shade [vshade] (d) -- (d -| b) coordinate (c) -- +(\borderwidth,-\borderwidth) coordinate (C) -- (d |- C) -- +(-\borderwidth,0) coordinate (D) -- cycle;
  \shade [hshade] (D) -- (A) -- (a) -- (d) -- cycle;
  \shade [hshade] (C) -- (B) -- (b) -- (c) -- cycle;

tikz solution

  • +1 yes, I think this is the right general approach for the pstricks too.
    – Alan Munn
    Aug 28, 2016 at 23:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .