/// <summary> /// Creates a new HighlightingColorizer instance. /// Derived classes using this constructor must override the <see cref="CreateHighlighter"/> method. /// </summary> protected ThemedHighlightingColorizer() { _themeManager = AppContext.Resolve<IThemeManager>(); _defaultStyle = new StylePart { Bold = false, Italic = false, Foreground = (_themeManager.CurrentTheme != null ? _themeManager.CurrentTheme.Foreground : "#000000") }; }
public SolidColorBrush GetBrush(StylePart style) { if (style == null) return Brushes.Black; var hexColor = style.Foreground; if (_brushCache.ContainsKey(hexColor)) return _brushCache[hexColor]; var brush = (SolidColorBrush) new BrushConverter().ConvertFrom(hexColor); _brushCache.Add(hexColor, brush); return brush; }
public SolidColorBrush GetBrush(StylePart style) { if (style == null) { return(Brushes.Black); } var hexColor = style.Foreground; if (_brushCache.ContainsKey(hexColor)) { return(_brushCache[hexColor]); } var brush = (SolidColorBrush) new BrushConverter().ConvertFrom(hexColor); _brushCache.Add(hexColor, brush); return(brush); }