private static Interop.Kernel32.Color ConsoleColorToColorAttribute(ConsoleColor color, bool isBackground)
{
if ((((int)color) & ~0xf) != 0)
throw new ArgumentException(SR.Arg_InvalidConsoleColor);
Contract.EndContractBlock();
Interop.Kernel32.Color c = (Interop.Kernel32.Color)color;
// Make these background colors instead of foreground
if (isBackground)
c = (Interop.Kernel32.Color)((int)c << 4);
return c;
}