Change Color Settings

Change Text and Background Colors in Desktop Tools

To change the colors that MATLAB® uses for text and background in desktop tools, follow these steps:

Note

The colors that you specify also apply to the Import Wizard, but do not apply to the Live Editor, the Help display pane or the web browser. In addition, changing the text and background colors in desktop tools is not supported in MATLAB Online™.

  1. On the Home tab, in the Environment section, click Preferences. Select MATLAB > Colors.

  2. Clear Use system colors.

    System colors are the text and background colors that your platform (for example, Microsoft® Windows®) uses for other applications.

  3. Select the colors that you want to use from the Text and Background color palettes.

    When you choose a color, the Syntax Highlighting sample and Command Window sample areas in the dialog box update to show you how it looks.

    Tip

    If you use a gray background color, a selection in an inactive window is not visible.

  4. Click OK.

Change Syntax Highlighting Colors

In the Command Window, Command History, Editor, Live Editor, and Shortcuts callback area, MATLAB conveys syntax information using different colors. This feature, known as syntax highlighting, helps you to identify syntax elements, such as if/else statements at a glance. The Editor also provides syntax highlights colors for other languages.

In the Command Window, only the MATLAB input you type is highlighted. The output from running MATLAB functions is not highlighted.

To change syntax highlighting colors, follow these steps:

  1. On the Home tab, in the Environment section, click Preferences. Select MATLAB > Editor/Debugger > Language.

  2. From the Language drop-down menu, select the language for which you want to change syntax highlighting colors.

  3. In the Syntax highlighting section, select Enable syntax highlighting.

  4. Change the colors.

    • If you set the Language to MATLAB, click the Set syntax colors link, and then change the colors under MATLAB syntax highlighting colors.

    • If you did not set the Language to MATLAB, change the colors under Syntax highlighting.

  5. Click OK.

In MATLAB Online,syntax highlighting colors preferences are located under MATLAB > Editor/Debugger > MATLAB Language and MATLAB > Editor/Debugger > Other Languages.

Change Command Window Colors

To change the colors that MATLAB uses for errors, warnings and hyperlinks in the Command Window, follow these steps:

  1. On the Home tab, in the Environment section, click Preferences. Select MATLAB > Colors.

  2. Select the colors that you want to use from the Error text and Warning text, and Hyperlinks color palettes.

    When you choose a color, the Command Window sample area in the dialog box updates to show you how it looks.

  3. Click OK.

Change Code Analyzer Colors

Code Analyzer helps you to identify potential problems and refine your MATLAB code. By default, the Editor indicates:

  • Code for which there are warnings, by underlining that code with an orange wavy line and placing an orange line in the message bar.

  • Code for which there are errors, by underlining that code with a red wavy line and placing a red line in the message bar.

  • Code that MATLAB can fix automatically (autofix), by highlighting that code in tan.

To change Code Analyzer colors:

  1. On the Home tab, in the Environment section, click Preferences. Select MATLAB > Colors > Programming Tools.

  2. Under Code analyzer colors, select the colors that you want for warnings, autofix highlighting, or both.

  3. Decide if you want autofix highlights to appear in the Editor.

    Clear Autofix highlight if you do not want autofix highlights to appear in the Editor; select Autofix highlight if you do.

  4. Click Apply.

  5. Decide if you want to change the color that the Code Analyzer uses for errors.

    • If you do not, go to step 6.

    • If you do, then:

      1. In the left navigation pane, click Colors.

      2. Under MATLAB syntax highlighting colors, change the color for Errors.

        In addition to changing the color of Code Analyzer indicators for errors, this action also changes the color for errors in the Command Window, Command History window, Editor, and Shortcuts callback area.

  6. Click OK.

For more information, see Automatically Check Code in the Editor and Live Editor — Code Analyzer.