Issue Summary:
When using HTMLExport in FastReport, the alpha channel in colors is not respected. This seems to be due to the usage of ColorTranslator.ToHtml() from the System.Drawing.Color library. I found a potential solution by modifying the HTMLColorCode function in the ExportUtils class to consider the alpha channel.
Steps to Reproduce:
Use HTMLExport in FastReport.
Export a report containing colors with alpha channels.
Expected Behavior:
The exported HTML should respect the alpha channel in colors.
Actual Behavior:
The alpha channel is not taken into account, leading to incorrect color representation in the exported HTML.
Proposed Solution:
Modify (and start using) the HTMLColorCode function in the ExportUtils class to include the alpha channel.
internal static string HTMLColor(Color color)
{
return HTMLColorCode(color);
}
internal static string HTMLColorCode(Color color)
{
string alpha = (color.A < 255) ? (color.A / 255.0).ToString("0.00", CultureInfo.InvariantCulture) : string.Empty;
string htmlColorCode = (string.IsNullOrEmpty(alpha))
? $"rgb({color.R}, {color.G}, {color.B})"
: $"rgba({color.R}, {color.G}, {color.B}, {alpha})";
return htmlColorCode;
}
This modification address the issue and ensure that the alpha channel is considered during HTML export. I can create a PR if you need so... Already tested in my code
Additional Information:
FastReport Version: all
Environment: Windows 11, C#, Visual Studio 2022
Thank you for your attention to this matter.
Issue Summary:
When using HTMLExport in FastReport, the alpha channel in colors is not respected. This seems to be due to the usage of ColorTranslator.ToHtml() from the System.Drawing.Color library. I found a potential solution by modifying the HTMLColorCode function in the ExportUtils class to consider the alpha channel.
Steps to Reproduce:
Use HTMLExport in FastReport.
Export a report containing colors with alpha channels.
Expected Behavior:
The exported HTML should respect the alpha channel in colors.
Actual Behavior:
The alpha channel is not taken into account, leading to incorrect color representation in the exported HTML.
Proposed Solution:
Modify (and start using) the HTMLColorCode function in the ExportUtils class to include the alpha channel.
This modification address the issue and ensure that the alpha channel is considered during HTML export. I can create a PR if you need so... Already tested in my code
Additional Information:
FastReport Version: all
Environment: Windows 11, C#, Visual Studio 2022
Thank you for your attention to this matter.