According to wikipedia, each of Messiaen's 8 preludes is associated with various colors.
1 La colombe (The dove) Orange, with violet veins.
2 Chant d'extase dans un paysage triste (Song of ecstasy in a sad landscape) Gray, mauve, Prussian blue at the beginning and end; diamond and silver at the middle.
3 Le nombre léger (The light number) Orange, with violet veins.
4 Instants défunts (Dead instants) Smooth gray with reflections of mauve and green.
5 Les sons impalpables du rêve (The impalpable sounds of a dream) Polymodal, consisting of a blue-orange mode with a chordal ostinato and cascades of chords, and a violet-purple mode having a copper timbre. Note the pianistic writing, composed of triple notes, rapid passages in chords, canon in contrary motion, hand crossing, various staccatos, brassy louré, gem effects.
6 Cloches d'angoisses et larmes d'adieu (Bells of anguish and tears of farewell) The bells combine several different modes: the "hum" (deep bass) and the upper harmonies of the bells sound with luminous vibrations. The farewell is purple, orange, violet.
7 Plainte calme (Calm plaint) Smooth gray with reflections of mauve and green.
8 Un reflet dans le vent (A reflection in the wind) The small storm which opens and concludes the piece alternates veins of orange, and green with black stains. The central development section is more luminous. The second theme, very melodious, and wrapped in sinuous arpeggios, is blue-orange in its first occurrence, and green-orange in its second one. Violet, orange and purple dominate the entire piece.
Were these associations random or how did he determine the colors for each prelude? The only method I can think of would have something to do with Synesthesia.