SyntaxColoring.AddTag
---------------------

Adds a new color tag for script step, variable, function or formula coloring.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SyntaxColoring](component_SyntaxColoring.md) | [3.0](newinversion30.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

MBS( "SyntaxColoring.AddTag"; Selector; Text; Color ) 

**MBS**( **"SyntaxColoring.AddTag";** /\* Adds a new color tag for script step, variable, function or formula coloring. \*/  
**$Selector**; /\* What item to color with this tag. Can be ScriptStep, Function, Variable or Formula.  
Added wildcards for Formula type in v11.5 to color specific keywords.e.g. "Formula" \*/   
**$Text**; /\* The name of the item. Up to five words from the left name of the command.e.g. "If" \*/   
**$Color**) /\* The color value. Can be one of a few english color names or "#123456" notation like in html.e.g. "red" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Selector | What item to color with this tag. Can be ScriptStep, Function, Variable or Formula.   Added wildcards for Formula type in v11.5 to color specific keywords. | "Formula" |
| Text | The name of the item. Up to five words from the left name of the command. | "If" |
| Color | The color value. Can be one of a few english color names or "#123456" notation like in html. | "red" |

### Result

Returns OK on success.

### Description

Adds a new color tag for script step, variable, function or formula coloring.  
Settings are saved in preferences files and you can use different settings in different FileMaker versions.  
Works with FileMaker 11 or newer.  
  
Default tags defined for script steps:  
| Sonst | blue |
|---|---|
| Sonst, | blue |
| Wenn | blue |
| Ende | blue |
| Schleife | teal |
| Verlasse | teal |
| If | blue |
| Else | blue |
| End If | blue |
| Loop | teal |
| End Loop | teal |
| Exit Loop | teal |
| Si | blue |
| Sinon | blue |
| Fin de si | blue |
| Boucle | teal |
| Fin de Boucle | teal |
| commented formula | red |

  
Possible tag names for syntax coloring in calculations:  
  
| Name | Default |
|---|---|
| round bracket color | blue |
| square bracket color | purple |
| curly bracket color | purple |
| wrong bracket color | red |
| text color | teal |
| variable color | plum |
| global variable color | plum |
| tilde variable color | - |
| cent variable color | - |
| underscore variable color | - |
| plus sign color | - |
| minus sign color | - |
| function color | - |
| and sign color | - |
| slash sign color | - |
| star sign color | - |
| paragraph sign color | - |
| field color | - |
| caret sign color | - |
| equal sign color | - |
| not equal sign color | - |
| bigger sign color | - |
| smaller sign color | - |
| bigger equal sign color | - |
| smaller equal sign color | - |
| number color | - |
| comment color | - |
| and color | - |
| or color | - |
| not color | - |
| xor color | - |

  
Possible special tag names for script step colors:  
  
| Name | Default |
|---|---|
| undefined variable color | red |
| commented formula | red |

  
Some color names you can use for syntax coloring:  
Black, Gray, DarkGray, LightGray, Blue, Brown, Cyan, Green, Magenta, Orange, Purple, Red, Yellow, White, alternateSelectedControlColor, alternateSelectedControlTextColor, controlBackgroundColor, controlColor, controlDarkShadowColor, controlHighlightColor, controlLightHighlightColor, controlShadowColor, controlTextColor, disabledControlTextColor, gridColor, headerColor, headerTextColor, highlightColor, keyboardFocusIndicatorColor, knobColor, scrollBarColor, secondarySelectedControlColor, selectedControlColor, selectedControlTextColor, selectedKnobColor, selectedMenuItemColor, selectedMenuItemTextColor, selectedTextBackgroundColor, selectedTextColor, shadowColor, textBackgroundColor, textColor, windowBackgroundColor, windowFrameColor, windowFrameTextColor, Cantaloupe, Honeydew, Spindrift, Sky, Lavender, Carnation, Licorice, Snow, Salmon, Banana, Flora, Ice, Orchid, Bubblegum, Lead, Mercury, Tangerine, Lime, "Sea Foam", Aqua, Grape, Strawberry, Tungsten, Silver, Maraschino, Lemon, Spring, Turquoise, Blueberry, Magenta, Iron, Magnesium, Mocha, Fern, Moss, Ocean, Eggplant, Maroon, Steel, Aluminum, Cayenne, Asparagus, Clover, Teal, Midnight, Plum, Tin and Nickel.  
  
You can reset to default rule set with [SyntaxColoring.FactoryDefaults](SyntaxColoringFactoryDefaults.md) function.  
Script steps colored in gray by FileMaker will stay gray, so you can see what is not available or disabled.  
### Examples

Enable coloring for set variable script step:

 MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; “Set Variable"; "#FF0000" )  
Set blue color for round bracket:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "round bracket color"; "blue" )  
Set green color for equal sign:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "equal bracket color"; "green" )  
Set green color for plus sign:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "plus sign color"; "#00FF00" )  
Enable coloring for set variable script step for missing field:

 MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; "\*&lt;Missing Field&gt;\*"; "#FF0000" )  
Color Hole() function blue in formulas:

 MBS ( "SyntaxColoring.AddTag"; "Function"; "Hole"; "blue" )  
Color variable $$UserID blue in formulas:

 MBS ( "SyntaxColoring.AddTag"; "Variable"; "$$UserID "; "blue" )  
Color all other functions in light red:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "function color"; "Salmon" )  
Set comment color to gray:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "comment color"; "gray" )  
Set color for undefined variables in script to red:

 MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; "undefined variable color"; "red" )  
Set color for tilde variable names:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "tilde variable color"; "green" )  
Set color for underscore variable names:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "underscore variable color"; "red" )  
Set color for cent variable names:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "cent variable color"; "green" )  
Set color for field names:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "field color"; "blue" )  
Set color for and:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "and color"; "red" )  
Set comment script steps to be dark green:

 MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; "#"; "#007700" )  
Color red all values starting with comment:

 MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; "\*Value: /\*\*"; "red" )  
Set color for global variables:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "global variable color"; "#ff69b4" )  
Set color for &lt;&gt; in formula:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "smaller bigger sign color"; "#0000FF" )  
Set Perform AppleScript script steps to be dark green:

 MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; "Perform AppleScript"; "#007700" )  
Set FIXME as prefix for comments for both formula and script steps:

 MBS ( "SyntaxColoring.AddTag"; "Formula"; "#fixme"; "red" ) &amp;  
MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; "#fixme"; "red" )  
Add zzz as something to highlight in calculations:

 MBS ( "SyntaxColoring.AddTag"; "formula"; "\*zzz\*"; "red" )  
Show script step for "Enter Find Mode" in red if pause is on:

 MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; "enter find mode \[ pause: on"; "red" )  
Color "go to next record" in orange, if the exit after last is not on:

 MBS ( "SyntaxColoring.AddTag"; "ScriptStep"; "\*exit after last: off\*"; "orange")  
### See also

- [SyntaxColoring.Clear](SyntaxColoringClear.md)
- [SyntaxColoring.Enable](SyntaxColoringEnable.md)
- [SyntaxColoring.FactoryDefaults](SyntaxColoringFactoryDefaults.md)
- [SyntaxColoring.Format](SyntaxColoringFormat.md)
- [SyntaxColoring.GetTag](SyntaxColoringGetTag.md)
- [SyntaxColoring.GetTags](SyntaxColoringGetTags.md)
- [SyntaxColoring.RemoveTag](SyntaxColoringRemoveTag.md)

### Release notes

- **Version 12.0**
    - Changed default comment color in scripts to dark green instead of black. Feel free to adjust with [SyntaxColoring.AddTag](https://www.mbsplugins.eu/SyntaxColoringAddTag.shtml) if you prefer other colors.
- **Version 11.5**
    - Added option for [SyntaxColoring.AddTag](https://www.mbsplugins.eu/SyntaxColoringAddTag.shtml) to add formula wildcard tags to color specific words.
- **Version 9.5**
    - Added new tag "global variable color" for [SyntaxColoring.AddTag](http://www.mbsplugins.eu/SyntaxColoringAddTag.shtml) function to give global variables a different color.
    - Added new tag "smaller bigger sign color" for [SyntaxColoring.AddTag](http://www.mbsplugins.eu/SyntaxColoringAddTag.shtml) function to give &lt;&gt; in formula a different color.

### Example Databases

- [Mac only/SyntaxColoring for Mac](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/SyntaxColoring%20for%20Mac.shtml#4ScriptAnchor_)

### Blog Entries

- [Goodies 38: Copy calculation text as html or styled text](https://www.monkeybreadsoftware.com/filemaker/SyntaxColoring/38-Copycalculationtextashtmlorstyledtext.shtml)
- [Goodies 32: Different colors for variables](https://www.monkeybreadsoftware.com/filemaker/SyntaxColoring/32-DifferentcolorsforvariablesinFileMaker.shtml)
- [Goodies 2: Calculation Coloring](https://www.monkeybreadsoftware.com/filemaker/SyntaxColoring/02-CalculationColoring.shtml)
- [Goodies 1: Script Coloring](https://www.monkeybreadsoftware.com/filemaker/SyntaxColoring/01-ScriptColoring.shtml)
- [MBS FileMaker Plugin, version 12.0pr8](https://www.mbsplugins.de/archive/2022-01-14/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [SyntaxColoring Updates](https://www.mbsplugins.de/archive/2021-10-27/SyntaxColoring_Updates/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.5pr2](https://www.mbsplugins.de/archive/2021-10-11/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Different colors for variables in FileMaker](https://www.mbsplugins.de/archive/2020-01-13/Different_colors_for_variables/monkeybreadsoftware_blog_filemaker)
- [Formatting and error checking expressions in FileMaker](https://www.mbsplugins.de/archive/2019-12-06/Formatting_and_error_checking_/monkeybreadsoftware_blog_filemaker)
- [Syntax Coloring Improvements](https://www.mbsplugins.de/archive/2012-10-25/Syntax_Coloring_Improvements/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2015, Seite 31](https://filemaker-magazin.de/neuigkeit/3845-Appetithappen-FMM_201505)

This function is free to use.

Created 18th August 2014 , last changed 15th September 2025

  
[SyntaxColoring.AddContextMenuCommand](SyntaxColoringAddContextMenuCommand.md) - [SyntaxColoring.AutoCompleteCustomFunctions.GetEnabled](SyntaxColoringAutoCompleteCustomFunctionsGetEnabled.md)

[HTML Version](SyntaxColoringAddTag.shtml)