Goodies 32: Different colors for variables

Did you know you can define different colors for your calculations in FileMaker for macOS?
  • Normal variables: $test
  • Global variables: $$test
  • Variables in Let starting with tilde: ~test
  • Variables in Let starting with cent: ¬Ętest
  • Variables in Let starting with underscore: _test
  • Specific variables like $$UserID with a different color, so you see when it's misspelled.
Those colors can be useful to distinguish different variables to read code easier and find logical mistakes in your code better.

You could define variables in a script to have specific colors in scripts and calculations:

# Color regular variables in black:

MBS( "SyntaxColoring.AddTag"; "ScriptStep"; "variable color"; "black" )

# Color undefined variables in red:

MBS( "SyntaxColoring.AddTag"; "ScriptStep"; "undefined variable color"; "red" )

# Color global variables:

MBS( "SyntaxColoring.AddTag"; "Formula"; "global variable color"; "#ff69b4" )

# Color variables starting with ~, _ or ¢:

MBS( "SyntaxColoring.AddTag"; "Formula"; "tilde variable color"; "green" )
MBS( "SyntaxColoring.AddTag"; "Formula"; "underscore variable color"; "green" )
MBS( "SyntaxColoring.AddTag"; "Formula"; "cent variable color"; "green" )

# Color a specific variable:

MBS( "SyntaxColoring.AddTag"; "Variable"; "$$UserID"; "blue" )

Please use SyntaxColoring.AddTag function in MBS FileMaker Plugin to change values as needed. Check fmSyntaxColorizer database from MrWatson included with our examples to define your own color set.

Font settings 32 Custom context menu commands