I had to change the title of your question so that visitors to the forum we immediately understand the context of this request. This makes it easier for those searching for a similar solution to find this post. Notice I have used the full name of the study as it appears in Thinkorswim.
To accomplish this you simply copy the entire code from the existing study and replace the final line of code:
parSAR.SetDefaultColor(GetColor(5));
With this line of code:
parSAR.AssignValueColor(if state == state.long then Color.CYAN else if state.short then Color.MAGENTA else GetColor(5));