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?
1 Answer
$\begingroup$
$\endgroup$
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.