MATLAB: Do colors in Simulink look different from colors in MATLAB

simulink

I notice that the colors in Simulink look different from colors set from MATLAB. As an example, if you right click on a Simulink block, and select "Background color -> Yellow", you will see a different shade of yellow than if you executed
figure('Color','yellow','MenuBar','none','Name','Color','NumberTitle','off','Units','normalized','Position',[.2 .8 .3 .1])
It appears that MATLAB and Simulink do use different palettes. MATLAB appears to use 'pure colors', for example Red corresponds to an RGB triplet of [1 0 0], just as you would get from many programming environments. Simulink appears to use a more subdued color palette, where for example Red is [0.9 0 0].

Best Answer

It appears that the custom color set in the Simulink editor includes the 'pure colors'. The intent was to present a color palette that would be more readable and less jarring in block diagrams. Unfortunately, the named colors cannot be changed by the user.
Both MATLAB and Simulink can deal with numeric color values. For example, the following statement sets the background color of the current Simulink block to match the background color of the current MATLAB figure:
set_param(gcb,'BackgroundColor',strcat('[',num2str(get(gcf,'Color')),']'));