| MATLAB® | ![]() |
| On this page… |
|---|
Setting Colors Used in Desktop Tools |
Desktop color preferences specify the colors used in MATLAB® desktop tools and the colors that convey syntax highlighting. Select File > Preferences > Colors to set color preferences for desktop tools. You can set some color options differently for printing — see Printing and Page Setup Options for Desktop Tools.

Use Desktop tool colors to change the color of the text and background in the desktop tools. The colors also apply to the Import Wizard. The colors do not apply to the HTML display pane nor to the Web Browser.
Select the check box Use system colors if you want the desktop to use the same text and background colors that your platform (for example, Microsoft® Windows®) uses for other applications.
To specify different text and background colors, follow these steps:
Click the arrow next to the Text color and choose a new color from the palette shown.
When you choose a color, the Sample area in the dialog box updates to show you how it will look.
Click the arrow next to the Background color and choose a new color.
If you use a gray background color, a selection in an inactive window will not be visible.
Click Restore Default Colors to return to the default settings for desktop tool colors, as well as for syntax highlighting colors.
The following illustration shows how the Current Directory browser looks with blue-green text and a beige background. These colors are only discernible in the online version of this documentation.

For some UNIX® platforms, there is a gray background color for desktop tools, such as the Editor. This occurs when the preference for Desktop tool colors is set to Use system colors, and the system's window manager uses gray as the background color default. To change the color, clear the check box for Use system colors and then select a new Background color from the palette.
In the Command Window, Command History, Editor, and Shortcuts callback area, MATLAB conveys syntax information via different colors to help you easily identify elements, such as if/else statements. This is known as syntax highlighting.
In the Command Window, only the input you type is highlighted; the output from running MATLAB functions is not highlighted.
Note To set syntax highlighting colors for TLC, ANSI® C language, C++, Sun Microsystems™ Java™ language, HTML, and XML files, use the Editor/Debugger language preferences by selecting File > Preferences, and then clicking Language. Click the Help button to get information on Language Preferences in the online documentation. |
When you choose a color under the M-file syntax highlighting colors area, the Sample area in the dialog box updates to show you how it will look.

The default colors are listed here:
Keywords — Flow control functions, such as for and if, as well as the continuation ellipsis (...), are colored blue.
Comments — All lines beginning with a %, designating the lines as comments in MATLAB, are colored green. Similarly, the block comment symbols, %{ and %}, as well as the code in between, appear in green. Text following the continuation ellipsis on a line is also green because it is a comment.
Strings — Type a string and it is colored maroon. When you complete the string with the closing quotation mark ('), it becomes purple. Note that for functions you enter using command syntax instead of function syntax, the arguments are highlighted as strings. This is to alert you that in command notation, variables are passed as literal strings rather than as their values. For more information, see MATLAB® Command Syntax in the MATLAB Programming Fundamentals documentation.
Unterminated strings — A single quote without a matching single quote, and whatever follows the quote, are colored maroon. This might alert you to a possible error.
System commands — Commands such as ! (shell escape) are colored gold.
Errors — Error text that appears after you run code, including any hyperlinks, is colored red.
Click Restore Default Colors to return to the default settings for syntax highlighting colors and desktop tool colors.
Note Syntax highlighting for M-files is enabled by default. If you find it is disabled, follow these steps to reenable it:
|
Specify the color for Hyperlinks, which applies to links in the Command Window and Help browser Index pane. If you use a dark background color for those tools, be sure to use a light or other contrasting color for hyperlinks so that you can see them.
With the M-Lint autofix highlight preference selected, code that M-Lint can automatically correct is highlighted in the Editor. Use the palette to change the highlight color. For more information, see M-Lint Automatic Code Analyzer in the Editor.
For information about other preferences and how the MATLAB program stores preferences, see Preferences.
![]() | Fonts Preferences for Desktop Tools | Toolbars Preferences for the MATLAB® Desktop and Editor | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |