The color and patterning of animal eggs has important consequences for offspring survival. There are examples of between-species and polymorphic differences in egg coloration in birds and amphibians [1-3], as well as cases of birds and insects whose nutritional status or age can cause within-individual variation in egg pigmentation [4-6]. However, no studies to date have demonstrated that individual animals can selectively control the color of their eggs. Here, we show that individual females of the predatory stink bug Podisus maculiventris can control the pigmentation of their eggs during oviposition, as a response to environmental conditions. The color of egg masses produced by individual females can range from pale yellow to dark black/brown. Females tend to lay darker eggs, which are more resistant to UV radiation, on the upper surface of leaves where UV exposure is highest in nature. Conversely, they lay lighter eggs on the undersides of leaves. However, egg color is not determined by the intensity of UV radiation falling on the surface where they are laid. Rather, female stink bugs appear to use a visual assessment of oviposition substrate reflectance to determine egg color. Unexpectedly, biochemical analyses revealed that the egg pigment is not melanin, the most ubiquitous light-absorbing pigment in animals. Our study offers the first example of an animal able to selectively control the color of its eggs.