From 042933fa2a0755c95686135d29bc0626d45088cb Mon Sep 17 00:00:00 2001 From: Adrian Date: Thu, 1 Feb 2024 09:46:43 +0100 Subject: [PATCH] Fixed alpha channel not being respected in colors during HTMLExport --- FastReport.Base/Export/ExportUtils.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/FastReport.Base/Export/ExportUtils.cs b/FastReport.Base/Export/ExportUtils.cs index 0c6e9b9a..ff0aee85 100644 --- a/FastReport.Base/Export/ExportUtils.cs +++ b/FastReport.Base/Export/ExportUtils.cs @@ -268,17 +268,12 @@ internal static string GetExcelFormatSpecifier(FormatBase format, bool useLocale internal static string HTMLColor(Color color) { - return ColorTranslator.ToHtml(color); - } - - internal static string HTMLColorCode(Color color) - { - return String.Join(String.Empty, new String[] { - "#", - color.R.ToString("X2"), - color.G.ToString("X2"), - color.B.ToString("X2") - }); + if (color.A < 255) + { + string alphaValue = (color.A / 255.0).ToString("0.00", INVARIANT_CULTURE); + return $"rgba({color.R}, {color.G}, {color.B}, {alphaValue})"; + } + return $"rgb({color.R}, {color.G}, {color.B})"; } internal static string ByteToHex(byte Byte)