Example #1
0
        ThemeColor CreateThemeColor(ColorType colorType)
        {
            var hl = new ThemeColor {
                Name = colorType.ToString()
            };

            var colorInfo = colorInfos[ToIndex(colorType)];

            if (!(colorInfo.DefaultForeground is null))
            {
                hl.Foreground = CreateColor(colorInfo.DefaultForeground);
            }

            if (!(colorInfo.DefaultBackground is null))
            {
                hl.Background = CreateColor(colorInfo.DefaultBackground);
            }

            if (!(colorInfo.DefaultColor3 is null))
            {
                hl.Color3 = CreateColor(colorInfo.DefaultColor3);
            }

            if (!(colorInfo.DefaultColor4 is null))
            {
                hl.Color4 = CreateColor(colorInfo.DefaultColor4);
            }

            return(hl);
        }
Example #2
0
 public override IEnumerable<Tuple<object, object>> GetResourceKeyValues(ThemeColor hlColor)
 {
     if (ForegroundResourceKey != null) {
         Debug.Assert(hlColor.Foreground != null);
         yield return new Tuple<object, object>(ForegroundResourceKey, hlColor.Foreground);
     }
     if (BackgroundResourceKey != null) {
         Debug.Assert(hlColor.Background != null);
         yield return new Tuple<object, object>(BackgroundResourceKey, hlColor.Background);
     }
 }
Example #3
0
 public override IEnumerable <Tuple <object, object> > GetResourceKeyValues(ThemeColor hlColor)
 {
     if (ForegroundResourceKey != null)
     {
         Debug.Assert(hlColor.Foreground != null);
         yield return(new Tuple <object, object>(ForegroundResourceKey, hlColor.Foreground));
     }
     if (BackgroundResourceKey != null)
     {
         Debug.Assert(hlColor.Background != null);
         yield return(new Tuple <object, object>(BackgroundResourceKey, hlColor.Background));
     }
 }
Example #4
0
 public override IEnumerable <Tuple <object, object> > GetResourceKeyValues(ThemeColor hlColor)
 {
     if (ForegroundResourceKey != null)
     {
         Debug.Assert(hlColor.Foreground != null);
         var brush = hlColor.Foreground;
         yield return(new Tuple <object, object>(ForegroundResourceKey, CreateDrawingBrush(brush)));
     }
     if (BackgroundResourceKey != null)
     {
         Debug.Assert(hlColor.Background != null);
         var brush = hlColor.Background;
         yield return(new Tuple <object, object>(BackgroundResourceKey, CreateDrawingBrush(brush)));
     }
 }
Example #5
0
        public override IEnumerable <Tuple <object, object> > GetResourceKeyValues(ThemeColor hlColor)
        {
            var br = new LinearGradientBrush()
            {
                StartPoint = StartPoint,
                EndPoint   = EndPoint,
            };

            for (int i = 0; i < GradientOffsets.Length; i++)
            {
                var gs = new GradientStop(((SolidColorBrush)hlColor.GetBrushByIndex(i)).Color, GradientOffsets[i]);
                gs.Freeze();
                br.GradientStops.Add(gs);
            }
            br.Freeze();
            yield return(new Tuple <object, object>(ResourceKey, br));
        }
Example #6
0
 public abstract IEnumerable <Tuple <object, object> > GetResourceKeyValues(ThemeColor hlColor);
Example #7
0
		ThemeColor CreateThemeColor(ColorType colorType) {
			var hl = new ThemeColor { Name = colorType.ToString() };

			var colorInfo = colorInfos[ToIndex(colorType)];

			if (colorInfo.DefaultForeground != null)
				hl.Foreground = CreateColor(colorInfo.DefaultForeground);

			if (colorInfo.DefaultBackground != null)
				hl.Background = CreateColor(colorInfo.DefaultBackground);

			if (colorInfo.DefaultColor3 != null)
				hl.Color3 = CreateColor(colorInfo.DefaultColor3);

			if (colorInfo.DefaultColor4 != null)
				hl.Color4 = CreateColor(colorInfo.DefaultColor4);

			return hl;
		}
Example #8
0
		ThemeColor ReadColor(XElement color, ref ColorType colorType) {
			var name = color.Attribute("name");
			if (name == null)
				return null;
			colorType = ToColorType(name.Value);
			if (colorType == ColorType.LastUI)
				return null;

			var colorInfo = colorInfos[ToIndex(colorType)];

			var hl = new ThemeColor();
			hl.Name = colorType.ToString();

			var fg = GetAttribute(color, "fg", colorInfo.DefaultForeground);
			if (fg != null)
				hl.Foreground = CreateColor(fg);

			var bg = GetAttribute(color, "bg", colorInfo.DefaultBackground);
			if (bg != null)
				hl.Background = CreateColor(bg);

			var color3 = GetAttribute(color, "color3", colorInfo.DefaultColor3);
			if (color3 != null)
				hl.Color3 = CreateColor(color3);

			var color4 = GetAttribute(color, "color4", colorInfo.DefaultColor4);
			if (color4 != null)
				hl.Color4 = CreateColor(color4);

			var italics = color.Attribute("italics") ?? color.Attribute("italic");
			if (italics != null)
				hl.FontStyle = (bool)italics ? FontStyles.Italic : FontStyles.Normal;

			var bold = color.Attribute("bold");
			if (bold != null)
				hl.FontWeight = (bool)bold ? FontWeights.Bold : FontWeights.Normal;

			return hl;
		}
Example #9
0
        ThemeColor ReadColor(XElement color, ref ColorType colorType)
        {
            var name = color.Attribute("name");

            if (name == null)
            {
                return(null);
            }
            colorType = ToColorType(name.Value);
            if (colorType == ColorType.LastUI)
            {
                return(null);
            }

            var colorInfo = colorInfos[ToIndex(colorType)];

            var hl = new ThemeColor();

            hl.Name = colorType.ToString();

            var fg = GetAttribute(color, "fg", colorInfo.DefaultForeground);

            if (fg != null)
            {
                hl.Foreground = CreateColor(fg);
            }

            var bg = GetAttribute(color, "bg", colorInfo.DefaultBackground);

            if (bg != null)
            {
                hl.Background = CreateColor(bg);
            }

            var color3 = GetAttribute(color, "color3", colorInfo.DefaultColor3);

            if (color3 != null)
            {
                hl.Color3 = CreateColor(color3);
            }

            var color4 = GetAttribute(color, "color4", colorInfo.DefaultColor4);

            if (color4 != null)
            {
                hl.Color4 = CreateColor(color4);
            }

            var italics = color.Attribute("italics") ?? color.Attribute("italic");

            if (italics != null)
            {
                hl.FontStyle = (bool)italics ? FontStyles.Italic : FontStyles.Normal;
            }

            var bold = color.Attribute("bold");

            if (bold != null)
            {
                hl.FontWeight = (bool)bold ? FontWeights.Bold : FontWeights.Normal;
            }

            return(hl);
        }
Example #10
0
 public override IEnumerable<Tuple<object, object>> GetResourceKeyValues(ThemeColor hlColor)
 {
     var br = new LinearGradientBrush() {
         StartPoint = StartPoint,
         EndPoint = EndPoint,
     };
     for (int i = 0; i < GradientOffsets.Length; i++) {
         var gs = new GradientStop(((SolidColorBrush)hlColor.GetBrushByIndex(i)).Color, GradientOffsets[i]);
         gs.Freeze();
         br.GradientStops.Add(gs);
     }
     br.Freeze();
     yield return new Tuple<object, object>(ResourceKey, br);
 }
Example #11
0
 public override IEnumerable<Tuple<object, object>> GetResourceKeyValues(ThemeColor hlColor)
 {
     if (ForegroundResourceKey != null) {
         Debug.Assert(hlColor.Foreground != null);
         var brush = hlColor.Foreground;
         yield return new Tuple<object, object>(ForegroundResourceKey, CreateDrawingBrush(brush));
     }
     if (BackgroundResourceKey != null) {
         Debug.Assert(hlColor.Background != null);
         var brush = hlColor.Background;
         yield return new Tuple<object, object>(BackgroundResourceKey, CreateDrawingBrush(brush));
     }
 }
Example #12
0
 public abstract IEnumerable<Tuple<object, object>> GetResourceKeyValues(ThemeColor hlColor);