Many animal species rely on changes in body coloration to signal social dominance, mating readiness and health status to conspecifics, which can in turn influence reproductive success, social dynamics and pathogen avoidance in natural populations. Such colour changes are thought to be controlled by genetic and environmental conditions, but their relative importance is difficult to measure in natural populations, where individual genetic variability complicates data interpretation. Here, we studied shifts in melanin-related body coloration in response to social context and parasitic infection in two naturally inbred lines of a self-fertilizing fish to disentangle the relative roles of genetic background and individual variation. We found that social context and parasitic infection had a significant effect on body coloration that varied between genetic lines, suggesting the existence of genotype by environment interactions. In addition, individual variation was also important for some of the colour attributes. We suggest that the genetic background drives colour plasticity and that this can maintain phenotypic variation in inbred lines, an adaptive mechanism that may be particularly important when genetic diversity is low.