Main Content

Change Desktop Colors

You can change the colors used by tools in MATLAB®, including the text and background colors, syntax highlighting colors, and output colors.

Change Text and Background Colors

By default, the tools in the MATLAB desktop environment use the same text and background colors that your system uses in other applications. You can change the text and background colors for certain desktop tools, including the Editor, Command Window, Current Folder browser, Workspace browser, and Import Wizard. In MATLAB Online™, changing the colors of the Current Folder browser and the Workspace browser is not supported.

To change the text and background colors:

  1. On the Home tab, in the Environment section, click Preferences.

  2. Select MATLAB > Colors.

  3. In the Desktop tool colors section, clear the Use system colors check box.

    In MATLAB Online, the Use system colors check box is not available and this step can be skipped.

  4. Use the Text and Background fields to change the colors. For example, select white for the text color and black for the background color.

    The Syntax Highlighting sample and Command Window sample areas show a preview of the selected colors.

    Sample panels showing a dark grey background and white text.

    To restore the default text and background colors, click the Restore Default Colors button at the bottom of the Preferences Window.

Changing the colors of the toolstrip and Help browser is not supported. To change the text colors for the Live Editor, use settings. For more information, see matlab.fonts Settings.

Change Syntax Highlighting Colors

MATLAB conveys syntax information in code using different colors. This feature, known as syntax highlighting, helps you to identify syntax elements, such as if/then/else statements, at a glance. Syntax highlighting appears in code files, in code you enter in the Command Window, and in error and warning messages. It does not appear in other kinds of output.

To change the colors used for syntax highlighting in MATLAB code:

  1. On the Home tab, in the Environment section, click Preferences.

  2. Select MATLAB > Colors.

  3. Use the Keywords, Comments, Strings, Unterminated strings, System commands, Syntax errors, and Validation sections fields to change the colors. For example, select magenta for the strings color and purple for the unterminated strings color.

    The Syntax Highlighting sample area shows a preview of the selected colors.

    Syntax highlighting sample panel showing strings in magenta and unterminated strings in purple.

    To restore the default syntax highlighting colors, click the Restore Default Colors button at the bottom of the Preferences window.

To disable syntax highlighting, in the Preferences window, select MATLAB > Editor/Debugger > Language. Then, in the Syntax Highlighting section, clear the Enable syntax highlighting check box. In MATLAB Online, this option is located under MATLAB > Editor/Debugger > MATLAB Language.

The Editor also provides syntax highlighting for other languages. To change the syntax highlighting colors for other languages, in the MATLAB > Editor/Debugger > Language Preferences window, select a language in the Language field. Then, change the colors for that language. To disable syntax highlighting for the language, clear the Enable syntax highlighting check box. In MATLAB Online, these options are located under MATLAB > Editor/Debugger > Other Languages.

For more information about syntax highlighting, see the Check Syntax as You Type.

Change Output Colors

MATLAB uses different colors to identify errors, warnings, and links in Command Window and Live Editor output.

To change the colors used for errors, warnings and links in output:

  1. On the Home tab, in the Environment section, click Preferences.

  2. Select MATLAB > Colors.

  3. Use the Error text, Warning text, and Hyperlinks in Command Window fields to change the colors. For example, select magenta for error text and green for warning text.

    The Command Window sample area shows a preview of the selected colors.

    Command Window sample panel showing error text in magenta and warning text in green.

    To restore the default output colors, click the Restore Default Colors button at the bottom of the Preferences window.

Change Programming Tools Colors

In the Editor and Live Editor, MATLAB uses additional colors to identify Code Analyzer messages, variables, functions, and sections. To change these colors, go to the Home tab, and in the Environment section, click Preferences. Then, select MATLAB > Colors > Programming Tools.

Code Analyzer Colors

To change the colors used to identify Code Analyzer messages in the Editor and Live Editor, in the Code analyzer colors section, select colors from the Warnings and Autofix highlight fields. To disable highlighting autofixes in the Editor and Live Editor, clear the Autofix highlight check box.

For more information about using the Code Analyzer, see Check Code for Errors and Warnings Using the Code Analyzer.

Variable and Function Colors

When you select a variable or function in the Editor or Live Editor, MATLAB highlights all occurrences of the specific variable or function. To change the color of this highlight, in the Variable and function colors section, select a color from the Automatically highlight field. To disable automatic highlighting in the Editor and Live Editor, clear the Automatically highlight check box. For more information about automatic highlighting, see Find and Replace Functions or Variables in Current File.

MATLAB also highlights variables with shared scope in the Editor and Live Editor. To change the color of this highlight, in the Variable and function colors, select a color from the Variables with shared scope field. The text is colored, not shaded. For more information about variables with shared scope, see Check Variable Scope in Editor.

See Also

|

Related Topics