コード例 #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);
        }
コード例 #2
0
ファイル: ColorInfo.cs プロジェクト: GreenDamTan/dnSpy
 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);
     }
 }
コード例 #3
0
ファイル: ColorInfo.cs プロジェクト: pashav15/pashav
 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));
     }
 }
コード例 #4
0
ファイル: ColorInfo.cs プロジェクト: pashav15/pashav
 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)));
     }
 }
コード例 #5
0
ファイル: ColorInfo.cs プロジェクト: pashav15/pashav
        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));
        }
コード例 #6
0
 public abstract IEnumerable <Tuple <object, object> > GetResourceKeyValues(ThemeColor hlColor);
コード例 #7
0
ファイル: Theme.cs プロジェクト: manojdjoshi/dnSpy
		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;
		}
コード例 #8
0
ファイル: Theme.cs プロジェクト: manojdjoshi/dnSpy
		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;
		}
コード例 #9
0
ファイル: Theme.cs プロジェクト: azureidea/dnSpy-1
        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);
        }
コード例 #10
0
ファイル: ColorInfo.cs プロジェクト: GreenDamTan/dnSpy
 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);
 }
コード例 #11
0
ファイル: ColorInfo.cs プロジェクト: GreenDamTan/dnSpy
 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));
     }
 }
コード例 #12
0
ファイル: ColorInfo.cs プロジェクト: GreenDamTan/dnSpy
 public abstract IEnumerable<Tuple<object, object>> GetResourceKeyValues(ThemeColor hlColor);