This post describes the changes and the implementation details.
![matlab colors matlab colors](http://www.gnuplotting.org/figs/matlab_line_colors_2014.png)
Matlab colors how to#
Matlab colors code#
Instead, simply use the following short code snippet (you may need to tweak it for particular Matlab versions) to change the colors of only the command text pane (that’s a Swing JTextArea, for those of you who are java-savvy). If you only wish to set the colors in the command window and not in all the other Matlab text panes, or if you only wish to modify this session, then forget the prefs method. This affects all Matlab text panes (Command Window, Command History, Workspace Browser etc.), for this and all future Matlab sessions. Note that colors can be specified in several alternative manners (see below). notif圜olorListeners ( 'ColorsBackground' ) Ĭom.('ColorsUseSystem',0) Ĭom.('ColorsBackground',) Ĭom.圜olorListeners('ColorsBackground') Īnd similarly for the foreground color, whose property name is called ‘ColorsText’. % Use specified colors for foreground/background (instead of the default black on white)Ĭom. Here is the bottom line regarding the colors:Ĭom. The issue of programmatic access to system preferences is detailed in another dedicated post. I do not know if there is any interest in the subject of this blog, so I would be extremely happy to hear feedback.Ĭhanging Command-Window colors can be done programmatically in two manners: The first is by modifying system preferences. This is important, for example, when we have two Matlab applications open at the same time and wish to visually distinguish between them.Īfter getting this email, one in a long list of similar questions I tackled over the past few years regarding Matlab’s undocumented/unsupported/hidden features, I decided it was time to start a blog on this broad subject. The question was whether it was possible to do so programmatically, in order to place the necessary commands in some script (for example, startup.m). This is possible from the File/Preferences window, but requires interactive user actions. Yesterday I received an email asking if it was possible to programmatically change Matlab’s Command Window foreground and background colors.