public FontColor GetDefaultColors(string category) { var currentTheme = themeManager.GetCurrentTheme(); bool success; FontColor color; switch (currentTheme) { case VisualStudioTheme.Dark: color = new FontColor(Color.FromRgb(220, 220, 220), Color.FromRgb(30, 30, 30)); success = themeColors[currentTheme].TryGetValue(category, out color); if (!success) { Debug.WriteLine("Classification theme manager can't read colors correctly."); } return(color); case VisualStudioTheme.Light: case VisualStudioTheme.Blue: default: color = new FontColor(Colors.Black, Colors.White); success = themeColors[currentTheme].TryGetValue(category, out color); if (!success) { Debug.WriteLine("Classification theme manager can't read colors correctly."); } return(color); } }
public FontColor GetDefaultColors(string category) { bool success; FontColor color; switch (_currentTheme) { case VisualStudioTheme.Dark: color = new FontColor(Color.FromRgb(220, 220, 220), Color.FromRgb(30, 30, 30)); success = DarkColors.TryGetValue(category, out color); if (!success) { LoggingModule.logWarningMessage(() => String.Format("Theme manager can't read colors correctly from {0} theme.", _currentTheme)); } return(color); case VisualStudioTheme.Light: case VisualStudioTheme.Blue: default: color = new FontColor(Colors.Black, Colors.White); success = LightAndBlueColors.TryGetValue(category, out color); if (!success) { LoggingModule.logWarningMessage(() => String.Format("Theme manager can't read colors correctly from {0} theme.", _currentTheme)); } return(color); } }
public void UpdateColors() { var newTheme = _themeManager.GetCurrentTheme(); if (newTheme != VisualStudioTheme.Unknown && newTheme != _currentTheme) { _currentTheme = newTheme; var colors = newTheme == VisualStudioTheme.Dark ? DarkColors : LightAndBlueColors; var formatMap = _classificationFormatMapService.GetClassificationFormatMap(category: "text"); try { formatMap.BeginBatchUpdate(); foreach (var pair in colors) { string type = pair.Key; FontColor color = pair.Value; var classificationType = _classificationTypeRegistry.GetClassificationType(type); var oldProp = formatMap.GetTextProperties(classificationType); var foregroundBrush = color.Foreground == null ? null : new SolidColorBrush(color.Foreground.Value); var backgroundBrush = color.Background == null ? null : new SolidColorBrush(color.Background.Value); var newProp = TextFormattingRunProperties.CreateTextFormattingRunProperties( foregroundBrush, backgroundBrush, oldProp.Typeface, null, null, oldProp.TextDecorations, oldProp.TextEffects, oldProp.CultureInfo); formatMap.SetTextProperties(classificationType, newProp); } } finally { formatMap.EndBatchUpdate(); } } }
public FontColor GetDefaultColors(string category) { var currentTheme = themeManager.GetCurrentTheme(); bool success; FontColor color; switch (currentTheme) { case VisualStudioTheme.Dark: color = new FontColor(Color.FromRgb(220, 220, 220), Color.FromRgb(30, 30, 30)); success = themeColors[currentTheme].TryGetValue(category, out color); if (!success) Debug.WriteLine("Classification theme manager can't read colors correctly."); return color; case VisualStudioTheme.Light: case VisualStudioTheme.Blue: default: color = new FontColor(Colors.Black, Colors.White); success = themeColors[currentTheme].TryGetValue(category, out color); if (!success) Debug.WriteLine("Classification theme manager can't read colors correctly."); return color; } }