It seems to me this line is representative of what the narrator of "The Fish" figuratively sees. This is an important fish, not just a fish or anyfish. This is a wonderful specimen of age and longevity and perseverence and character.
On the outside, though, the fish is not what anyone would call beautiful--
battered and venerable
and homely. Here and there
his brown skin hung in strips
like ancient wallpaper....
It is scarred and battered and lice-ridden and trailing bits of other fisherman's lures and lines. This fish is a testament to age and strength and character and perseverence. While there is an actual rainbow on the spilled oil around the engine on the bottom of the boat, the rainbow in this line is more about the figurative or symbolic nature of a rainbow. This ugly brown trout did not, all of a sudden, regain its coloring; instead, it is an image seen by the narrator of what this fish is on the inside. And the symbolism of promise and hope and beauty are all realized in that image of a rainbow. Then--"I let the fish go."