Setting the editor (not Live editor) text and background colors from code
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (1)
Rik
il 12 Dic 2023
1 voto
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 Commento
Trym Gabrielsen
il 12 Dic 2023
Modificato: Trym Gabrielsen
il 12 Dic 2023
Categorie
Scopri di più su System Commands in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!