added tab colour support for new messages
replaced redundant code by a function