The recent discovery of nonvisual photoreceptors in various organs has raised expectations for uncovering their roles and underlying mechanisms. In this work, we identified a previously unrecognized hormone-releasing mechanism in the pituitary of the Japanese rice fish (medaka) induced by light. Ca2+ imaging analysis revealed that melanotrophs, a type of pituitary endocrine cell that secretes melanocyte-stimulating hormone, robustly increase the concentration of intracellular Ca2+ during short-wavelength light exposure. Moreover, we identified Opn5m as the key molecule that drives this response. Knocking out opn5m attenuated melanogenesis by reducing tyrosinase expression in the skin. Our findings suggest a mechanism in which direct reception of short-wavelength light by pituitary melanotrophs triggers a pathway that might contribute to protection from ultraviolet radiation in medaka.