The letters in the color need to be in uppercase: #FF0000 rather than #ff0000.
Otherwise, that is indeed how you would specify the color change in MusicXML. However, you will also need a MusicXML reader that supports these types of color changes. Many scoring applications don't seem to support this MusicXML feature yet.
VP of MusicXML Technologies