I am attempting to generate a plot for which the color changes for selected values of x as determined by a function. Below, is my best, unsuccessful attempt. The specific problem with this is that it worked only once for x = 3Pi/4 but not for x = Pi/4. I am stumped, please help!
Plot[ {Cos[x], Sin[x]}, {x, 0, Pi}, ColorFunction -> Function[ x, If[Abs[Cos[x]] > Abs[Sin[x]], Red, Blue] ] ] 

Plot[{Cos[x], Sin[x]}, {x, 0, Pi}, ColorFunction -> Function[x, If[Abs[Cos[x]] > Abs[Sin[x]], Red, Blue]], ColorFunctionScaling -> False]$\endgroup$Plot[{Sin[x], Cos[x]}, {x, 0, Pi}, MeshFunctions -> Function[{x, y}, Abs[Cos[x]] - Abs[Sin[x]]], MeshShading -> {Blue, Red}, Mesh -> {{0}}]is another way. $\endgroup$