An easy alternative is to change your record command and assign it to this instead:
Code:
local default_col = 0x808080 -- Set this value to the default color you want
local record_col = 0xCC0000 -- Set this value to the red color you want
reaper.Main_OnCommand(1013, 0) -- Record Command
local color = reaper.GetPlayState()&4 == 4 and record_col or default_col
reaper.SetThemeColor('col_trans_fg', color, 0)
And to make sure your color is always reset on stop you change your Spacebar action to this:
Code:
local default_col = 0x808080 -- Set this value to the default color you want
reaper.Main_OnCommand(40044, 0) -- Play stop command
reaper.SetThemeColor('col_trans_fg', default_col, 0)
You can even map those scripts to the Transport buttons with the new addition of WALTER's custom buttons. But this is another subject