Setting the editor (not Live editor) text and background colors from code
Show older comments
I am trying to make a function that allows me to quickly change the color scheme of my MATLAB editor. I found here:Access and Modify Settings, that I can use the settings groups to change my preferences from code.
I am able to set many of the color settings from code this way:
s = settings;
s.matlab.colors.KeywordColor.TemporaryValue = [0 190 190];
However, I cannot find the text and background color in here:
>> s.matlab.colors
ans =
SettingsGroup 'matlab.colors' with properties:
ValidationSectionColor: [1×1 Setting]
KeywordColor: [1×1 Setting]
CommentColor: [1×1 Setting]
StringColor: [1×1 Setting]
UnterminatedStringColor: [1×1 Setting]
SyntaxErrorColor: [1×1 Setting]
SystemCommandColor: [1×1 Setting]
commandwindow: [1×1 SettingsGroup]
programmingtools: [1×1 SettingsGroup]
>> s.matlab.colors.commandwindow
ans =
SettingsGroup 'matlab.colors.commandwindow' with properties:
HyperlinkColor: [1×1 Setting]
ErrorColor: [1×1 Setting]
WarningColor: [1×1 Setting]
>> s.matlab.colors.programmingtools
ans =
SettingsGroup 'matlab.colors.programmingtools' with properties:
HighlightAutofixes: [1×1 Setting]
VariablesWithSharedScopeColor: [1×1 Setting]
AutomaticallyHighlightVariables: [1×1 Setting]
AutofixHighlightColor: [1×1 Setting]
VariableHighlightColor: [1×1 Setting]
ShowVariablesWithSharedScope: [1×1 Setting]
CodeAnalyzerWarningColor: [1×1 Setting]
What I am looking for are these colors

How can I change these in code?
Accepted Answer
More Answers (1)
Rik
on 12 Dec 2023
1 vote
You can dig into the code to find the actual field you can use. It might not be documented, but it hasn't changed in years, so you're probably good until Mathworks rolls out the new desktop as the default.
1 Comment
Trym Gabrielsen
on 12 Dec 2023
Edited: Trym Gabrielsen
on 12 Dec 2023
Categories
Find more on System Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!