Skip to content

Commit 41bd5d5

Browse files
author
Travis Nielsen
committed
add regex case for color matching
1 parent a43b882 commit 41bd5d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/lib/SvgManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,12 @@ private async Task<bool> ManipulateSvgFills(string inputPath, string outputPath,
154154
var content = File.ReadAllText(inputPath);
155155

156156
// get all hexidecimal colors in the SVG
157-
var hexColors = Regex.Matches(content, "(#[a-fA-F0-9]{6})(\")|(#[a-fA-F0-9]{3})(\")");
157+
var hexColors = Regex.Matches(content, "(#[a-fA-F0-9]{6})(\")|(#[a-fA-F0-9]{3})(\")|(#[a-fA-F0-9]{6})(;)");
158158

159159
foreach(var hexColor in hexColors)
160160
{
161161
var hexColorString = hexColor.ToString().Trim('"');
162+
hexColorString = hexColorString.Replace(";", "");
162163
var currentColor = System.Drawing.ColorTranslator.FromHtml(hexColorString);
163164
var newColor = manipulation(currentColor);
164165
content = content.Replace(hexColorString, newColor.ToHexString());

0 commit comments

Comments
 (0)