# Blending colors of shapes with their background color

I have this code:

Graphics[
{Polygon[CirclePoints[25, 4]],
{Yellow, Disk[{0, -15}, 1]},
{Yellow, Disk[{0, 0}, 1]},
{Yellow, Disk[{0, 15}, 1]},
{Blue, Disk[{-15, 0}, 1]},
{Blue,Disk[{-15, 15}, 1]},
{Blue, Disk[{-15, -15}, 1]},
{Yellow,Disk[{15, -15}, 1]},
{Blue, Disk[{15, 0}, 1]},
{Yellow, Disk[{15, 15}, 1]},
{Red, Rectangle[{-16, -16}, {-14, 16}]},
{Red, Rectangle[{-1, -16}, {1, 16}]},
{Red, Rectangle[{14, -16}, {16, 16}]}}]


I am trying to figure out a simple way to make the yellow disks turn orange and the blue to turn purple when the red is over them. I looked at Blend but cannot see how that would help. I feel like there must be a simple way to do this, but have very little experience with Mathematica graphics.

• You want to use Opacity. – wxffles Feb 7 '17 at 22:08
• Yep... just insert Opacity[0.5], before Polygon.... – David G. Stork Feb 7 '17 at 22:27
• Possible duplicates: (11565), (14836), (47809) – Mr.Wizard Feb 8 '17 at 2:23

Not only should you introduce Opacity as suggested in the comments, you should also rearrange the order of evaluation in your graphics expression.

Graphics[
{Polygon[CirclePoints[25, 4]],
{Red,
Rectangle[{-16, -16}, {-14, 16}],
Rectangle[{-1, -16}, {1, 16}],
Rectangle[{14, -16}, {16, 16}]},
{Opacity[.5],
{Yellow,
Disk[{0, -15}, 1], Disk[{0, 0}, 1], Disk[{0, 15}, 1], Disk[{15, -15}, 1],
Disk[{15, 15}, 1]},
{Blue,
Disk[{-15, 0}, 1], Disk[{-15, 15}, 1], Disk[{-15, -15}, 1],
Disk[{15, 0}, 1]}}}]