Implement generic color support for terminals

fixes #7396
Remove some unnecessary #includes
Add missing locks

refs #7251