10 Lay Out a Programmatic UI
Standard Background Color
MATLAB uses the standard system background color of the system on which the UI
is running as the default component background color. This color varies on different
computer systems, e.g., the standard shade of gray on the PC differs from that on UNIX
system, and may not match the default UI background color.
You can make the UI background color match the default component background color.
This code gets the default component background color and assign it to the figure.
defaultBackground = get(groot,'defaultUicontrolBackgroundColor');
fh.Color = defaultBackground;