private static void SetCore(ShellTextStyle style, bool on) { if (style == ShellTextStyle.None) { throw new ArgumentOutOfRangeException(nameof(style)); } Console.Write($"\x1B[{(on ? "" : "2")}{_controlCodeTable[style]}m"); }
public static ShellTextStyler Set(ShellTextStyle style) { if (style == ShellTextStyle.None) { throw new ArgumentOutOfRangeException(nameof(style)); } var styler = new ShellTextStyler(style, _currentStyle); _currentStyle = style; SetCore(style, true); return(styler); }
private ShellTextStyler(ShellTextStyle offStyle, ShellTextStyle onStyle) { _offStyle = offStyle; _onStyle = onStyle; }