1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
6
using ICSharpCode.AvalonEdit.AddIn;
8
namespace ICSharpCode.PackageManagement.EnvDTE
10
public class FontsAndColorsItems
12
static readonly string PlainTextItem = "Plain Text";
14
ICustomizedHighlightingRules highlightingRules;
15
List<CustomizedHighlightingColor> colors;
17
public FontsAndColorsItems()
18
: this(new CustomizedHighlightingRules())
22
public FontsAndColorsItems(ICustomizedHighlightingRules highlightingRules)
24
this.highlightingRules = highlightingRules;
27
public ColorableItems Item(string name)
29
if (IsPlainText(name)) {
30
return CreatePlainTextColorableItems();
35
bool IsPlainText(string name)
37
return String.Equals(name, PlainTextItem, StringComparison.InvariantCultureIgnoreCase);
40
ColorableItems CreatePlainTextColorableItems()
42
CustomizedHighlightingColor color = FindPlainTextHighlightingColor();
44
color = AddPlainTextHighlightingColorToCustomColors();
46
return new ColorableItems(PlainTextItem, color, this);
49
CustomizedHighlightingColor FindPlainTextHighlightingColor()
51
return Colors.Find(c => c.Name == CustomizableHighlightingColorizer.DefaultTextAndBackground);
54
CustomizedHighlightingColor AddPlainTextHighlightingColorToCustomColors()
56
var color = new CustomizedHighlightingColor() {
57
Name = CustomizableHighlightingColorizer.DefaultTextAndBackground
63
List<CustomizedHighlightingColor> Colors {
66
colors = highlightingRules.LoadColors();
74
highlightingRules.SaveColors(Colors);