It looks like a real mess but it is actually pretty much connecting color to color.
The only real trick is making for certain that the power is off and buying the correct ballast.
As long as you know the type and number of bulbs in your light, you are good to go!
How do you know if your ballast is out?
If you replace all the bulbs with new ones and you have power in the black wire powering the ballast… You almost for sure have a bad ballast! (If the white common line is broken or disconnected you will not have power either, but that is extremely rare)
Happy wiring! And be safe…