Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to set the Background color of a PopupMenu to blue. I already searched in the documentation center, but I didn't find any option that seemed suitable.

 PopupMenu[
    Dynamic[x], 
    {"Country1", "Country2", "Country3"}, 
    ImageSize -> {180, 60}, Background -> Blue,
    Alignment -> {Center, Center},
    MenuStyle ->Directive[Orange, 20, Bold]
 ]

enter image description here

share|improve this question

2 Answers 2

To get the look subbu asked for on OS X, I had to override the default appearance of the pop-up menu widget. Here is what I came up with:

PopupMenu[Dynamic@x, {"Country1", "Country2", "Country3"}, "", 
   Row[{Panel[Style[Dynamic@x, Orange, 20, Bold, Background -> Blue], 
           ImageSize -> {160, 60}, Appearance -> None, Background -> Blue, 
           Alignment -> {Center, Center}], 
        Panel[Style["\[FilledDownTriangle]", 16, Bold, 
           Background -> White], ImageSize -> {20, 60}, Appearance -> None, 
           Alignment -> {Center, Center}]}, Frame -> True, 
      FrameMargins -> None], MenuStyle -> Directive[Orange, 20, Bold]]

It produces a control that looks like this:

custom pop-up menu

share|improve this answer
    
@m_goldberg.Really I like your code.but How can i set background color for Menu ? –  subbu Nov 23 '12 at 7:36

I am assuming that you made the blue background in a graphics program to show us what you want because on my computer your blue background is obscured by the default appearance.

enter image description here

Setting Appearance->None will fix this ...although on my mac I lose the "guiding up-down arrows" when I do that.

enter image description here

share|improve this answer
1  
I'm not sure, but could the OP have meant to ask how to color the pop-up part of the menu blue and not the fixed part? The latter he already colored blue. –  Sjoerd C. de Vries Nov 22 '12 at 21:30
    
@SjoerdC.deVries I assumed he made that in a graphics program because his code does not deliver that screen grab on my computer ...will add a grab. –  Mike Honeychurch Nov 22 '12 at 21:40
1  
It looked like that on my Win7 PC. So, no manual coloring there... –  Sjoerd C. de Vries Nov 22 '12 at 21:54
    
@SjoerdC.deVries interesting. Maybe that is what he meant. I'll wait for him to reply/clarify. Might be worth leaving this answer here for Mac users. –  Mike Honeychurch Nov 22 '12 at 23:04
2  
Why no copyable code? –  Mr.Wizard Nov 23 '12 at 0:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.