Principle #1: There are two types of fishes here. Ones that swim by themselves and ones that swim together.
Principle #2: Sharks are more attracted to the color orange and yellow. So orange/yellow fishes would be eaten most. Especially if their by themselves. Fishes who are in groups is harder for predators to attack.
Principle #3: Fishes who stay in groups and have good colors like blue, have a better more chance at surviving and reproducing. Most fishes may swim by themselves but mutations can happen and they could swim faster and not be attracted. Those traits can be passed on. Swimming together is like an learned adaption.
Principle #4: In the next generation there will be more fishes who are less attracted to sharks, and are fast swimmers. also learned adaptions to being in groups to have better fitness. There will be less colorful fishes.