I had similar issues, but with a DVI input on a monitor.
For me at least the rainbow screen was showing sometimes, but often also not.
After tons of different settings in config.txt (which didn’t solve the issue) and different hdmi-dvi cables, I ended up reinstalling Raspbian. After that I got the screen working again.
The only thing is that there is no red color on my monitor. Tried different power supplies, cables and certain settings in config.txt, none of them fixed my red color missing issue.
But that is another story…
Give it a shut to reinstall. Don’ t forget to save data as reinstall is wiping the sd card.