When I code in *Mathematica*, I often find myself having to repeat large chunks of code for a function to work. The latest example of this is a color changing button that prints when clicked, code shown below.

```
Mouseover[
 Style[
  Button[
   Pane["Print", FrameMargins -> {{4, 4}, {4, 4}}, 
    ImageSize -> {34, 24}],
   Print["Print"],
   Appearance -> None
   ], Background -> Red
  ],
 Style[
  Button[
   Pane["Print", FrameMargins -> {{4, 4}, {4, 4}}, 
    ImageSize -> {34, 24}],
   Print["Print"],
   Appearance -> None
   ], Background -> Green
  ]
 ]

```

The only thing that is changing on the mouse over is the button color, but for this to work I need to repeat a whole chunk of code.

A simpler way of doing this is to define a button color function, and then use that in the Mouseover function, code shown below.

```
ButtonColor[color_] :=
 Style[
  Button[
   Pane["Print", FrameMargins -> {{4, 4}, {4, 4}}, 
    ImageSize -> {34, 24}],
   Print["Print"],
   Appearance -> None
   ], Background -> color
  ]

Mouseover[
 ButtonColor[Red],
 ButtonColor[Green]
 ]

```

This is better, but what if i only have to refer to the button color changing function for one mouse over button? Should I really have to define a function to use it for one instance?

I think the ideal way to code this would be to use Table or something similar, code shown below.

```
Mouseover[
 Table[
  Style[
   Button[
    Pane["Print", FrameMargins -> {{4, 4}, {4, 4}}, 
     ImageSize -> {34, 24}],
    Print["Print"],
    Appearance -> None
    ], Background -> color
   ],
  {color, {Red, Green}}
  ]
 ]

```

The only problem, Table doesn't work because it creates EXTRA BRACES!

Is there a better way of coding this color changing button?