what degree in the sky does the sun change color? I would like to know at what angle in the sky the sun changes from a white yellow to orange and red. I know that after sunset it's considered twilight until 18° beneath the horizon. So how many degrees above the horizon generally before the sun changes color?
Here's a partial answer:
As mentioned in the comments, the transmission of the atmosphere depends quite a lot on local factors. But given a transmission $T_0(\lambda)$ at zenith, the transmission at an angle $\theta$ from zenith can be written
$$
T(\lambda,\theta) = T_0(\lambda)\times X(\theta),
$$
where $X$ is the air mass.
The air mass can be approximated as $X=\sec\theta$ up to $\theta\simeq70^\circ$, but as you approach the horizon, the calculation becomes increasingly model-dependent. A relatively simple expression is given by Pickering (2002):
$$
X(\theta) = \csc\left(90^\circ-\theta + \frac{244}{165+(90^\circ\!\!-\!\theta)^{1.1}} \right),
$$
where $\theta$ is measured in degrees, and $\csc x\equiv 1/\!\sin x$. This model doesn't take into account refraction (which requires ray-tracing), so may be off by half a degree or so when the Sun is at the horizon.
If $S_0(\lambda)$ is the un-transmitted Solar spectrum, the observed spectrum is then
$$
S_\mathrm{obs}(\lambda,\theta) = S_0(\lambda)\times T_0(\lambda)\times X(\theta).
$$
Calculating the color that the human eye perceives, given a spectrum, is not trivial, but I recently outlined an approch in this answer.