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. In MATLAB Online™, you also can use themes to change the colors of the MATLAB desktop, for example, by selecting a dark theme. For more information, see MATLAB Online Only: Select Theme.

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, Live Editor, Command Window, Current Folder browser, Workspace browser, and Import Wizard.

To change the text and background colors:

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

  2. Select MATLAB > Colors.

    In MATLAB Online, select MATLAB > Appearance > 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 black 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.

The Live Editor automatically selects colors for titles and headings based on the selected background color. To further customize the colors of titles and headings, use the Customize Styles dialog box or the matlab.fonts Settings. For more information, see Format Text in the Live Editor.

Changing the text and background colors does not change the colors of the toolstrip. In MATLAB Online, changing the text and background colors also does not change the colors of the Workspace panel.

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.

    In MATLAB Online, select MATLAB > Appearance > Colors.

  3. In the MATLAB syntax highlighting colors section, 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 Check Syntax and Autocomplete Code 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.

    In MATLAB Online, select MATLAB > Appearance > Colors.

  3. In the MATLAB output colors section, 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, and functions. To change these colors, go to the Home tab, and in the Environment section, click Preferences. Then, select MATLAB > Colors > Programming Tools. In MATLAB Online, select MATLAB > Appearance > 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 that 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 uses text of a different color to call out variables with shared scope in the Editor and Live Editor. To change the color of variables with shared scope, in the Variable and function colors section, select a color from the Variables with shared scope field. To disable calling out variables with shared scope in the Editor and Live Editor, clear the Variables with shared scope check box. For more information about variables with shared scope, see Check Variable Scope in Editor.

MATLAB Online Only: Select Theme

In MATLAB Online, you also can use themes to change the colors of the MATLAB desktop.

Note

Themes are not supported in an installed version of MATLAB.

Windows® and macOS systems support light and dark color schemes. By default, MATLAB Online is configured to match the current operating system color scheme using the system theme. If the selected color scheme for the operating system changes, the colors of the MATLAB desktop change to match the new scheme.

To change the selected theme, on the Home tab, in the Environment section, click Preferences. Select MATLAB > Appearance and select a theme from the Theme field. For example, select Dark to select a dark theme or System to select a theme that matches the current operating system scheme.

The MATLAB Appearance Preferences page shows a preview of the selected theme.

MATLAB Appearance Preferences page with the Theme drop-down list open and dark theme selected. A preview below the drop-down list shows a sample MATLAB desktop with a dark background.

After selecting a theme, you can further customize the colors of the MATLAB desktop by selecting MATLAB > Appearance > Colors and changing the colors in the Desktop tool colors, MATLAB syntax highlighting colors, and MATLAB output colors sections.

MATLAB Online saves your color customizations for each available theme. If you customize the colors of the MATLAB Online desktop and then the MATLAB theme changes to a new theme or to match a change to the operating system color scheme, your customizations are saved.

See Also

|

Related Topics