14
$\begingroup$

I want to change the colour of some important variables in my code. My code is quite long and sometimes I have to change these specific variables, but it is quite annoying to search them, beacause their is no contrast and it is hard to find them. Is their a possibility to change their colour?

$\endgroup$
1
16
$\begingroup$

Define a new type of symbol (context) called highlight,

SetOptions[$FrontEndSession, 
 AutoStyleOptions -> {"SymbolContextStyles" -> {"highlight`" -> 
      Green}}]

AppendTo[$ContextPath, "highlight`"];

and before those important variables (symbols) appear for the first time, tell Mathematica to add them to the highlight context (e.g. var1 and var2). They will be green everywhere.

highlight`var1; 
highlight`var2;

The method was posted in this answer, and it is explained at length therein.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.