Ceiling light won't switch off after replacement
Wire color isn't a certainty, particularly with switched power. You need to be certain of how it was wired before and use the same configuration. Without that, you need to disconnect and use test equipment (non-contact tester, multimeter) to determine the neutral, hot line, which hot goes to the switch, and which hot is switched. A common convention would be black as always hot and red is a switched hot, but you need to test to be sure.

Once you have identified the wires, the light fixture will be connected to the neutral and switched hot. The hot from the line needs to go through the switch to become the switched hot. And neutrals should all be connected together.