Button background color
This is relatively minor, but has been bugging me for a while. When I create TitleBoxes or SetVariables on a panel, the background color (set by the labelback and valuelabelback keywords) matches the color in the color selection palette and the colors you see on traces. However, for buttons, the button color does not correspond to the color in the selection palette and is always several shades lighter. If I set the appearance to os9 then the colors match better, but I can't seem to get the colors to match with the normal button appearance, even when adjusting the button or panel background colors. Is there a way to get the button color to better match what appears in the color palette?
The code below creates a panel with several buttons of different shades of red to demonstrate this.
PauseUpdate; Silent 1 // building window...
NewPanel /W=(445,246,749,395)
SetDrawLayer UserBack
TitleBox Title_Red_Bkg,pos={4.00,8.00},size={97.00,113.00},title="\\f01 Title box with\rred bkg "
TitleBox Title_Red_Bkg,labelBack=(65535,0,0),frame=0,fixedSize=1
Button Button_Red_Color,pos={105.00,6.00},size={140.00,20.00},title="\\f01Button with red color"
Button Button_Red_Color,fColor=(65535,0,0)
Button Button_Red_Color_os9,pos={105.00,93.00},size={190.00,20.00},title="\\f01Button with red color, os9 style"
Button Button_Red_Color_os9,fColor=(65535,0,0),appearance={os9,Win}
Button Button_Red_Color_Red_Bkg,pos={105.00,28.00},size={160.00,20.00},title="\\f01Button with red color, bkg"
Button Button_Red_Color_Red_Bkg,labelBack=(65535,0,0),fColor=(65535,0,0)
Button Button_Red_Color_Dark_Red_Bkg,pos={105.00,50.00},size={165.00,20.00},title="\\f01Button with dark red color"
Button Button_Red_Color_Dark_Red_Bkg,fColor=(13107,0,0)
TitleBox Title_Dark_Red_Bkg,pos={106.00,74.00},size={159.00,16.00},title="\\f01 Title box with dark red bkg "
TitleBox Title_Dark_Red_Bkg,labelBack=(13107,0,0),frame=0
TitleBox Title_Dark_Red_Bkg,fColor=(65535,65535,65535)
SetVariable setvar_Red_Bkg,pos={103.00,117.00},size={110.00,19.00},bodyWidth=60,title="\\f01Red bkg"
SetVariable setvar_Red_Bkg,labelBack=(65535,0,0),valueColor=(65535,0,0)
SetVariable setvar_Red_Bkg,valueBackColor=(65535,0,0),value= _STR:""
EndMacro
I'm going out on a limb to suggest you are working on a Macintosh...
Macintosh doesn't think a button should be colored. To try to preserve the Macintoshy look, I implemented the color by overlaying a semi-transparent color on top of the normally-drawn button. The result is what you see. You can also get a better color using the Fusion style (Misc->Miscellaneous Settings, Miscellaneous category) and it looks somewhat better than coloring an os9 appearance button. But it makes all of Igor look rather different.
October 3, 2019 at 04:33 pm - Permalink
I'm actually on a Windows 10 machine with Igor 8.0.3.3. I should have mentioned that in the original post. I've attached pictures of what the panel looks like with "normal" settings and with fusion. Fusion does indeed make Igor look funny.
October 3, 2019 at 05:07 pm - Permalink
I'll have to look at the code to see what we do in the Windows case.
October 3, 2019 at 05:18 pm - Permalink
Is there an update on this? I'm having a similar issue. Is it possible to have the Fusion style be implemented just on specific Windows/graphs/panels instead of it being a global change? I'm building a GUI with a particular palette in mind but the button backgrounds specifically look muted when not using the Fusion style.
August 1, 2020 at 08:51 am - Permalink
If you set the appearance to os9 (Button MyButton, appearance={os9}), the colors are less muted (see the images I posted earlier). It ended up being good enough for my purposes.
August 3, 2020 at 01:39 pm - Permalink
In reply to If you set the appearance to… by KZarzana
Awesome! That is good enough for my purposes as well. Thanks for your help!
August 4, 2020 at 07:41 pm - Permalink