Skip to main content

color - Changing background colour of a Manipulate element


Please consider the following:


 Manipulate[Plot[Sin[x (1 + a x)], {x, 0, 6}], {a, 0, 2}];

Now, I would like to change the background colour to yellow. I tried the following, but in this case the nice looking rounded corners of the manipulate element get lost:


Panel[#, Background -> Yellow] &@
Manipulate[Plot[Sin[x (1 + a x)], {x, 0, 6}], {a, 0, 2},
Paneled -> False]


Maybe somebody has a better idea.


EDIT


The background colour of Manipulateis by default grey. <code>Manipulate</code>


In addition the graphical element in which the Manipulate is embedded has rounded corners rounded corner which I would like to keep. Applying my approach will change the colour but I loose the rounded corners.



Answer



If you would like to change background of Manipulate function - this is a way. Note I'll show you most difficult case when you have to go from light to dark colors change - then you have to pay attention to styling of internal graphics too, so everything (like ticks) are visible.


st = {FontColor -> GrayLevel[.7]};
Framed[Manipulate[
Plot[Sin[x (1 + a x)], {x, 0, 6}, Background -> GrayLevel[.3],
PlotStyle -> {Thick, Orange}, Frame -> True, BaseStyle -> st,

ImageMargins -> 7], {{a, 1, "frequency"}, 0, 2,
Appearance -> "Labeled"}, Paneled -> False], FrameMargins -> 30,
Background -> Black, BaseStyle -> st, RoundingRadius -> 10]

enter image description here


Comments