File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,13 +164,27 @@ $([Web.HttpUtility]::HtmlAttributeEncode($descriptionMessage))
164164 Select-Object - ExpandProperty Html
165165 " </h4>"
166166
167+ # Make a really basic heatmap (yes, this is that easy)
168+ # We want the fastest item to be the most green, so start by getting its relative speed
169+ $fastestRelativeSpeed = $buildTimes [0 ].RelativeSpeed
167170 foreach ($buildTime in $buildTimes ) {
171+ # We only neeed two colors for the heatmap: green and red.
172+ # Green is calculated by:
168173 $green = [byte ][Math ]::Floor(
169- (1 - $buildTime.RelativeSpeed ) * 255
174+ # Starting at one
175+ (1 -
176+ # Subtracting the relative speed
177+ $buildTime.RelativeSpeed +
178+ # and adding the fastest relative speed.
179+ $fastestRelativeSpeed
180+ ) * 255 # (multiply by 255 and floor it to make a byte)
170181 )
182+ # Red is even easier, it's just the relative speed as a byte
171183 $red = [byte ][Math ]::Floor(
172184 $buildTime.RelativeSpeed * 255
173185 )
186+
187+ # Use a bit of C# string formatting to make a color (blue is always blank)
174188 $color = " #{0:x2}{1:x2}00" -f $red , $green
175189
176190 " <details open>"
You can’t perform that action at this time.
0 commit comments