Prevent Terminal from overwriting preferences on exit When a user loads my C++ program, I want Terminal to look a certain way. I solved this by wrapping my program in an AppleScript .app which overwrites ~/Library/Preferences/com.apple.Terminal.plist (making a backup first) before opening the program. With a subsequent killall cfprefsd, this works (if Terminal wasn't open to begin with!), but I don't want to mess up the user's own Terminal preferences. So, after calling my program I overwrite  ...Terminal.plist again with the backup of the original settings.

The problem is that when my program is done and Terminal closes, its preferences are automatically overwritten with that of the current window, meaning the user is stuck with the look I set for my program. I tried to counter this by having the AppleScript wait until Terminal was closed and then overwriting the plist with the backup once more, which works, but if my app were to be closed before Terminal then this fails of course. And the whole process seems pretty hacky to begin with.

Can I prevent Terminal from overwriting its preferences when it closes? Or even better, can I have my code run in a terminal that looks the way I want without messing with the user's settings? Preferably I wouldn't use Terminal at all to run my code (so it also doesn't fail when Terminal was already open), but I think the only alternative is writing my own...
I'd look into what can be done with applescript using the scripting dictionary. 

script editor > file > open scripting dictionary

I do not know the details of what you are doing but here are some coloring options.