Strawberry & Raspberry jam discoloration
For strawberry jam, the discoloration that happens over time is when the pelargonidin, i.e. the red color breaks down, leaving you with a brownish-red or greyish mush instead of a vibrant red jam.

The breaking down is sped up by a warm environment and exposure to light, starting with long cooking time (probably not an issue in your case), and continuing in storage. The easiest way is to store the jars in the freezer - they will be protected from light and once thawed, still have the enticing red of freshly cooked strawberry jam. We pulled out a jar the other day that was from last year and there was no visual difference noticeable.

Alternatives are adding a small amount of a more stable red color, e.g. black currant, aronia, elderberry or even beet juice. It may change the “pure” strawberry flavor, though.

The more color is in your jam at the beginning, the longer will it stay red. If you have the choice, choose fully ripe fruit and cultivars that are red all through the fruit instead of ones with a paler interior. But in the end, freezing is the safest method.

As raspberries’ red is based on the same chemical components, I would assume the same mechanisms apply as for strawberries. But raspberry jam never lasts long enough in our home to change color, so I don’t have experimental data available.