A while back, I started using iTerm2's Dynamic Profiles. However, I haven't had to do much modification since a lot of my profile setup was done through the UI before I switched to Dynamic Profiles.
If you're not aware, once you switch to Dynamic Profiles, you must use the JSON file to edit them. For reasons I don't fully understand, you cannot use the UI to edit the profile anymore. This makes it rather difficult to understand certain parts of the JSON schema because they use Unicode escape characters for things like escape sequences or modifier keys.
However, the strangest part of the entire profile, and the part I wanted to modify today, was simply setting a color when a certain piece of text showed up on screen.
Here's an example of a previous highlight trigger action:
If you're not aware, once you switch to Dynamic Profiles, you must use the JSON file to edit them. For reasons I don't fully understand, you cannot use the UI to edit the profile anymore. This makes it rather difficult to understand certain parts of the JSON schema because they use Unicode escape characters for things like escape sequences or modifier keys.
However, the strangest part of the entire profile, and the part I wanted to modify today, was simply setting a color when a certain piece of text showed up on screen.
Here's an example of a previous highlight trigger action:
{ "action": "HighlightTrigger", "disabled": false, "parameter": "{YnBsaXN0MDDUAQIDBAUGBxBYJHZlcnNpb25ZJGF...(4,500 characters continued!)}", "regex": "ERROR", "partial": true },
It was a massive, unwieldy and undecipherable string. I tried base64 decoding, plist readers, etc and couldn't figure out what this string was.
The weirdest part is... iTerm2 acknowledges this, but doesn't explain it!
The solution? Just replace that massive string with hex codes...
{ "action": "HighlightTrigger", "disabled": false, "parameter": "{#aaffe4,#1a182b}", "regex": "ERROR", "partial": true }
If anyone knows what that weird string is... or why iTerm2 doesn't use something simpler—I'd love to hear from you!