Refactored to allow both powertab's and the visual studio nuget console's version of Register-TabExpansion to work, as used in posh-git
The posh-hg prompt did not handle getting undefined background colors returned from System.Management.Automation.Internal.Host.InternalHost.UI.RawUI.XXX when running inside the NuGet Package Manager powershell console. Replaced all calls to write-host with a new function write-prompt that checked for background colors set to -1 and ignored them. This is the same technique used by posh-git.