Grouping behaviour is widespread across the animal kingdom, and is known to reduce an individual's risk of predation, for example through predator confusion. Theory predicts that individuals that are different in appearance to the rest of the group are at a greater risk of predation because they are more conspicuous to predators (the ‘oddity’ effect). Thus, animals should choose group mates that are the most similar in appearance to themselves. Another common antipredator tactic is crypsis (camouflage). Fishes are capable of changing colour to match their visual background, but few studies have examined how this might influence shoaling decisions, particularly in the context of the oddity effect. We induced colour pattern changes in a colourful species of freshwater fish, the western rainbowfish, Melanotaenia australis, by maintaining fish in dark and pale aquaria for 2 weeks. Analysis of the proportion of black body pigmentation confirmed that rainbowfish in dark environments developed darker colour patterns than those held in pale environments. We then conducted behavioural observations to determine whether fish subsequently based their shoaling decisions on body coloration. We found that rainbowfish preferred to shoal with similar individuals; fish that had been held in dark aquaria preferred to shoal with other dark fish and fish from pale aquaria preferred other pale fish. Our findings are consistent with the predictions of the oddity effect and demonstrate how morphological colour pattern changes and behavioural decisions interact to mediate antipredator tactics in fish.