Refactor Homebrew's Tty class

which was incorporated into our codebase

* separate attributes from colors
* don't reset all attributes when setting a color
* allow chaining for multiple attributes
* cover all basic colors and attributes
* use more standard names ie Tty#underline instead of Tty#em
* add Tty#bg_red, etc.
* sanity checks
* style

This fixes some minor bugs such as the display of underline under single
dash in audit output.
Merge pull request #8402 from rolandwalker/refactor_homebrew_tty

Refactor Homebrew's `Tty` class