public void Write(ConsoleStyle style) { var cursorIndex = CursorIndex; EditLine.EnableStyleAt(cursorIndex, style); Render(cursorIndex); }
public bool ClearStyle(ConsoleStyle style) { var removed = RemoveStyle(style, _leadingStyles); removed = RemoveStyle(style, _trailingStyles) || removed; for (var i = 0; i < _chars.Count; i++) { var consoleChar = _chars[i]; if (consoleChar.StyleMarkers != null) { removed = RemoveStyle(style, consoleChar.StyleMarkers) || removed; } } return(removed); }
private static bool RemoveStyle(ConsoleStyle style, List <ConsoleStyleMarker> markers) { bool styleRemoved = false; if (markers == null) { return(false); } for (var i = markers.Count - 1; i >= 0; i--) { var consoleStyleMarker = markers[i]; if (consoleStyleMarker.Style == style) { markers.RemoveAt(i); styleRemoved = true; } } return(styleRemoved); }
public ConsoleStyleMarker(ConsoleStyle style, bool enabled) { Style = style; Enabled = enabled; }