Ultimately, it’s related to color management, as @Grum999 has already mentioned, and that’s quite an extensive topic. If you knew the color profile used by your gallery, then you could convert your images to that profile to prevent these color differences. Unfortunately, the profiles of most galleries are not known. I recommend this chapter of the manual, or maybe you read the whole chapter about color, it is very instructive.
Michelist