Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Shared Files/Resources/reportparts.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<ReportParts>
<ReportPart Name="SliderLeftColour" SelectedThemeColourName="EnvironmentColors.ToolWindowTextColorKey" />
<ReportPart Name="SliderRightColour" SelectedThemeColourName="EnvironmentColors.ToolWindowTextColorKey" />
<ReportPart Name="SliderThumbColour" SelectedThemeColourName="EnvironmentColors.ScrollBarThumbBackgroundColorKey" />
<ReportPart Name="ScrollBarArrowColour" SelectedThemeColourName="EnvironmentColors.ScrollBarArrowBackgroundColorKey" />
<ReportPart Name="ScrollBarTrackColour" SelectedThemeColourName="EnvironmentColors.ScrollBarBackgroundColorKey" />
<ReportPart Name="ScrollBarThumbColour" SelectedThemeColourName="EnvironmentColors.ScrollBarThumbBackgroundColorKey" />
<ReportPart Name="ComboBoxColour" SelectedThemeColourName="CommonControlsColors.ComboBoxBackgroundColorKey" />
<ReportPart Name="ComboBoxBorderColour" SelectedThemeColourName="CommonControlsColors.ComboBoxBorderColorKey" />
<ReportPart Name="ComboBoxTextColour" SelectedThemeColourName="CommonControlsColors.ComboBoxTextColorKey" />
<ReportPart Name="GrayCoverage" SelectedThemeColourName="EnvironmentColors.SystemGrayTextColorKey" />
<ReportPart Name="GrayCoverageColour" SelectedThemeColourName="EnvironmentColors.SystemGrayTextColorKey" />
<ReportPart Name="BackgroundColour" SelectedThemeColourName="EnvironmentColors.ToolWindowBackgroundColorKey" />
<ReportPart Name="FontColour" SelectedThemeColourName="EnvironmentColors.ToolWindowTextColorKey" />
<ReportPart Name="TableBorderColour" SelectedThemeColourName="EnvironmentColors.GridLineColorKey" />
Expand Down
8 changes: 7 additions & 1 deletion SharedProject/Core/ReportGenerator/IReportColours.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal interface IReportColours

Color FontColour { get; }

Color GrayCoverage { get; }
Color GrayCoverageColour { get; }

Color HeaderBorderColour { get; }

Expand All @@ -52,6 +52,12 @@ internal interface IReportColours
Color TextBoxColour { get; }

Color TextBoxTextColour { get; }

Color SliderLeftColour { get; }

Color SliderRightColour { get; }

Color SliderThumbColour { get; }
}

}
21 changes: 12 additions & 9 deletions SharedProject/Core/ReportGenerator/JsThemeStyling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ public class JsThemeStyling
public string DownActiveBase64;
public string DownInactiveBase64;
public string UpActiveBase64;
public string GrayCoverage;
public string ComboBox;
public string ComboBoxBorder;
public string ComboBoxText;
public string ScrollBarArrow;
public string ScrollBarTrack;
public string ScrollBarThumb;
//#pragma warning restore SA1401 // Fields should be private
//#pragma warning restore IDE0079 // Remove unnecessary suppression
public string GrayCoverageColour;
public string ComboBoxColour;
public string ComboBoxBorderColour;
public string ComboBoxTextColour;
public string ScrollBarArrowColour;
public string ScrollBarTrackColour;
public string ScrollBarThumbColour;
public string SliderLeftColour;
public string SliderRightColour;
public string SliderThumbColour;
//#pragma warning restore SA1401 // Fields should be private
//#pragma warning restore IDE0079 // Remove unnecessary suppression
}
}
8 changes: 7 additions & 1 deletion SharedProject/Core/ReportGenerator/ReportColours.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal class ReportColours : IReportColours

public Color FontColour { get; set; }

public Color GrayCoverage { get; set; }
public Color GrayCoverageColour { get; set; }

public Color HeaderBorderColour { get; set; }

Expand All @@ -52,6 +52,12 @@ internal class ReportColours : IReportColours
public Color TextBoxColour { get; set; }

public Color TextBoxTextColour { get; set; }

public Color SliderLeftColour { get; set; }

public Color SliderRightColour { get; set; }

public Color SliderThumbColour { get; set; }
}

}
54 changes: 54 additions & 0 deletions SharedProject/Core/ReportGenerator/ReportColoursExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace FineCodeCoverage.Engine.ReportGenerator
{
internal static class ReportColoursExtensions
{
private class ColourReflection
{
public PropertyInfo ReportColoursPropertyInfo { get; set; }
public FieldInfo JsThemeStylingFieldInfo { get; set; }
}
private static List<ColourReflection> colourReflections;
private static List<ColourReflection> ColourReflections
{
get
{
if (colourReflections == null)
{
var reportColourPropertyInfos = typeof(IReportColours).GetProperties();
var jsThemeStylingFieldInfos = typeof(JsThemeStyling).GetFields();
colourReflections = reportColourPropertyInfos.Select(prop =>
{
var field = jsThemeStylingFieldInfos.FirstOrDefault(f => f.Name == prop.Name);
if (field == null)
{
return null;
}
else
{
return new ColourReflection { ReportColoursPropertyInfo = prop, JsThemeStylingFieldInfo = field };
}
}).Where(cr => cr != null).ToList();
}
return colourReflections;
}
}
public static JsThemeStyling Convert(this IReportColours reportColours)
{
var jsThemeStyling = new JsThemeStyling();
ColourReflections.ForEach(cr =>
{
cr.JsThemeStylingFieldInfo.SetValue(jsThemeStyling, ((System.Drawing.Color)cr.ReportColoursPropertyInfo.GetValue(reportColours)).ToJsColour());
});
return jsThemeStyling;
}

public static string ToJsColour(this System.Drawing.Color colour)
{
return $"rgba({colour.R},{colour.G},{colour.B},{colour.A})";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class ReportColoursProvider : IReportColoursProvider

public event EventHandler<IReportColours> ColoursChanged;

private static PropertyInfo[] propertyInfos;
private static readonly PropertyInfo[] propertyInfos;
static ReportColoursProvider()
{
propertyInfos = typeof(ReportColours).GetProperties();
Expand Down
Loading