I think that the protagonist had fallen in love with someone of their own race, which is obviously forbidden love. This book may also have had in it a law that forbade casting a shadow on solar panels too, but I may just be confusing it with another.
It wasn't the main point of the story, but this was an element of Piers Anthony's 'Ghost'; the 'miscegenation act' was imposed to force all of the races to end up melding together, in effect ending discrimination, as well as reducing population increase. In effect, it simply restricted anyone of a clearly defined race from engaging in reproductive sexual activity with someone of the same, or very close, race.
The exception is made for during space flight, where such rules are relaxed to facilitate relaxation in general in the stressful environment. A women on board of the same race as the protagonist, however, should therefore be accessible to our hero... And she promptly kills herself, as she cannot reconcile this possibility with her view of the hero as a 'father-like' figure.
As to the 'Shadow on solar panel section'.. Does this sound like it might be what you were referring to? :
The top of the building was covered with solar collectors, each unit enclosed by clear plastic so as to make an oven effect. The sunlight entered freely, [....] Only a narrow walkway remained for access to the blimp dock, and a sign said WATCH YOUR SHADOW.
Dunno about it being illegal, but clearly frowned upon.