Skip to content

Instantly share code, notes, and snippets.

@devhawk
Created October 28, 2017 01:32
Show Gist options
  • Save devhawk/18ab4024688755c0323661c91d479df2 to your computer and use it in GitHub Desktop.
Save devhawk/18ab4024688755c0323661c91d479df2 to your computer and use it in GitHub Desktop.
class Konsole : IDisposable
{
ConsoleColor _orig_fg;
public static IDisposable Color(ConsoleColor fg)
{
var k = new Konsole()
{
_orig_fg = Console.ForegroundColor
};
Console.ForegroundColor = fg;
return k;
}
public void Dispose()
{
Console.ForegroundColor = _orig_fg;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment