Skip to content

Commit a4b0418

Browse files
committed
fix calendar svg converter
1 parent b3bb623 commit a4b0418

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/Model/Calendar.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.RegularExpressions;
66
using System.Text;
77
using AngleSharp.Dom;
8+
using System.Globalization;
89

910
namespace AdventOfCode.Model;
1011

@@ -97,7 +98,7 @@ public static Calendar Parse(int year, IDocument document) {
9798
foreach (var textNode in GetText(calendar)) {
9899
var text = textNode.Text();
99100
var style = textNode.ParentElement.ComputeCurrentStyle();
100-
var rgbaColor = style["color"];
101+
var rgbaColor = !string.IsNullOrEmpty(style["color"]) ? style["color"]: "rgba(204,204,204,1)";
101102
var bold = !string.IsNullOrEmpty(style["text-shadow"]);
102103

103104
if (style["position"] == "absolute" ||
@@ -111,7 +112,7 @@ public static Calendar Parse(int year, IDocument document) {
111112

112113
var m = Regex.Match(widthSpec, "[.0-9]+");
113114
if (m.Success) {
114-
var width = double.Parse(m.Value) * 1.7;
115+
var width = double.Parse(m.Value, CultureInfo.InvariantCulture) * 1.7;
115116
var c = (int)Math.Round(width - text.Length, MidpointRounding.AwayFromZero);
116117
if (c > 0) {
117118
text += new string(' ', c);

0 commit comments

Comments
 (0)