Automatically coloring grobs to indicate when their direction has been manually set

When editing a piece of music, it can be helpful to see when the directions of slurs, stems, or other grobs have been manually set (as opposed to being automatically set by LilyPond). This snippet changes the color of grobs when their direction has been manually set. Red indicates up, and blue indicates down. It can be applied to all grobs, or just to certain types of grob (i.e. just Slur, or just Slur and TextScript).