private void ApplyTheme() { if (_themedHighlights == null || _isThemeInitialized) { return; } _isThemeInitialized = true; // Replace matching colors in highlightingdefinition with colors from theme sytaxdefinition. var items = colorDict.ToArray(); for (var i = 0; i < items.Length; i++) { var newColor = _themedHighlights.ColorGet(items[i].Key); if (newColor == null) { continue; } var key = items[i].Key; colorDict.Remove(key); colorDict.Add(key, newColor); } }