Sunlight's distance through the atmosphere
Sunrises and sunsets are red because when we see the sun on the horizon, its light passes through more air than when the sun is directly overhead. How much air depends on its density at different altitudes, but since I only need a rough calculation, we'll use basic geometry and say the atmosphere ends at the Kármán line, 62 miles above sea level.
Figuring out the distance between an observer and the Kármán line over the horizon only requires two applications of the Pythagorean theorem:
For a six-foot observer at sea level, sunlight at sunrise and sunset passes through 706 miles of air, more than 11 times as much as when the sun is directly overhead.
To plot the change in distance from overhead to horizon, we can use the law of cosines, with R + h and R + H as two sides and varying the angle between them to calculate the third side:
The change is essentially linear. That suggests the transition from blue noon to red sunset happens slowly throughout the afternoon, not in just the last hour or two of daylight, something like this:
That doesn't match obesrvations. Sunlight doesn't change color gradually through the afternoon. It changes abruptly, in the last half hour or so before sunset. Possibly SVG color gradients don't transition the same way light does (the diagram above seems to pass from blue to red through brown), but more likely the atmosphere's higher pressure at lower altitude makes more of a difference than the above simplistic model accounts for.