Skip to content

Commit 9b8f240

Browse files
committed
Ensure to trim input before parsing the color
1 parent af8711e commit 9b8f240

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Html2OpenXml/Primitives/HtmlColor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public HtmlColor(double alpha, byte red, byte green, byte blue) : this()
4848
/// <returns>Returns <see cref="HtmlColor.Empty"/> if parsing failed.</returns>
4949
public static HtmlColor Parse(ReadOnlySpan<char> span)
5050
{
51+
span = span.Trim();
52+
5153
// Is it in hexa? Note: we no more accept hexa value without preceding the '#'
5254
if (span[0] == '#')
5355
{

0 commit comments

Comments
 (0)