This question has two parts : is it wise to change the colors of your lights ? and is it legal to do so ?
Concerning whether, regardless of the law, you could change the color of your lights, I'd say it heavily depends on which color you choose, and in which country you live.
Lights have to purposes: to see correctly the road and to be seen correctly.
- Concerning the first part, in some conditions, having some lights that are not the usual ones can have some benefits. In particular, I'm thinking about having a yellow front light (instead of a white one). A yellow light is less blazzing than a white one, in particular in the fog. This is actually why, in France, from the late 30's till 1993, only yellow front lights were allowed [1]. As of today, they are still allowed, but tend to disappear nontheless, except on old bike where they are still pretty common. However, if, for instance, you put a dark blue front light, then it is almost useless.
- Concerning the "to be seen" part [2], some people argue that having a blinking light (front and rear) is more likely to attract the eye of other drivers, hence you'd be noticed from a further distance. This arguments has two drawbacks, however: (1) even if you notice blinking lights from a greater distance, it is much harder to evaluate if this light comes closer to you or go away. This can be a trouble if you have a red blinking front light for instance. (2) This doesn't scale. You can distinguish a single blinking light from far away, but say you have 10 blinking lights, out of sync. You can not precisely tell how many people are there.
Finally, remember that lights are not here to be fun, they are here for the two purposes above, hence you should always respect the conventions of the community. These are what people expect other people to do. If you put red and green lights on the side of you bike (like boats or plane), people won't understand what you're doing.
On the legal side, this heavily depends on the country you live in. It would be smart that everybody expose his local laws.
For France, all you need is in the Code de la Route, Partie reglementaire, Livre III : Le véhicule, Chapitre III: Éclairage et signalisations, Section 1 : Éclairage et signalisation des véhicules. It's all available (in french) here
The first article (R313-1) is actually the most important with respect to your question which basically says that except the lights described after, you can not put any lights.
Tout véhicule ne peut être pourvu que des dispositifs d'éclairage ou de signalisation prévus au présent code. Ceux-ci doivent être installés conformément aux prescriptions du présent chapitre.
Ces dispositions ne concernent pas l'éclairage intérieur des véhicules sous réserve qu'il ne soit pas gênant pour les autres conducteurs.
Le fait, pour tout conducteur d'un véhicule à moteur ou à traction animale, de contrevenir aux dispositions du présent article est puni de l'amende prévue pour les contraventions de la troisième classe.
Le fait, pour tout conducteur d'un cycle, de contrevenir aux dispositions du présent article est puni de l'amende prévue pour les contraventions de la première classe.
(Traduction and emphasis mine)
Any vehicle can only be equipped with the light or sound equipment provided in the following regulation. They have to be installed according to the specifications of this chapter.
These rules are not about the inner lighting of the vehicle, provided that it is not disturbing for other drivers
The fact, for any driver of a motor or animal powered vehicle, to breach this article is punished of a fine for 3rd class infractions.
The fact, for any driver of a cycle, to breach this article is punished of a fine for 1st class infractions.
Notice that, as a cyclist, your ticket will be much lower than for cars (up to 38€ vs up to 450€).
The lights you are supposed to have are described in the following, in particular in the R313-4 (front light) and R313-5 (back light)
...
X.-La nuit, ou le jour lorsque la visibilité est insuffisante, tout cycle doit être muni d'un feu de position émettant vers l'avant une lumière non éblouissante, jaune ou blanche.
...
XIII.-Le fait pour tout conducteur d'un cycle de contrevenir aux dispositions du présent article est puni de l'amende prévue pour les contraventions de la première classe.
...
X.-The night, or the day when the visibility is not sufficient, any cycle should be equiped of a position light emitting toward the front a non-blazzing light, yellow or white.
...
XIII.-The fact, for any driver of a cycle to breach this aricle is punished of a fine for 1st class infraction
and for the rear one
...
V.-La nuit, ou le jour lorsque la visibilité est insuffisante, tout cycle doit être muni d'un feu de position arrière. Ce feu doit être nettement visible de l'arrière lorsque le véhicule est monté.
...
XI.-Le fait, pour tout conducteur d'un cycle, de contrevenir aux dispositions du présent article est puni de l'amende prévue pour les contraventions de la première classe.
...
V.-The night, or the day when the visibility is not sufficient, any cycle should be equiped of a rear position light. This light should be clearly visible from the rear when the cycle is ridden
...
XI.-The fact, for any driver of a cycle, to breach this article is punished of a fine for 1st class infraction.
(I actually just noticed that it is not required that the rear light is red, which is for motor vehicle).
Finally, notice that you have other obligations regarding lights, in particular for reflectors.
[1] Notice that the introduction of yellow lights corresponds to the begining of the 2WW, hence the widely spread (and wrong) belief that yellow lights were introduce to distinguish french cars from foreign cars in the night. More info on wikipedia (french).
[2] I don't have any link to any serious study, but the argument still makes sense. If you have some, please comment.