As discussed in some earlier questions Rainbows are a bad Omen yet we are Halachicly commanded to make a Bracha on it. The Gemara in Chagigah (16A) says you may not gaze at one so how do you make the Bracha on the bad omen you are not supposed to look at?
You are not supposed to gaze at it, however if you notice it you make a Bracha.
When one sees a rainbow a bracha should be made. However, one should be careful not to stare at a rainbow for too long (Orach Chaim 229:1).
The Be'er Hataiv 2 in Orach Chaim 229:1 says that looking at a rainbow weakens the eyes.