A GIF image is color-indexed, each color is a one-byte index in a 256-colors (max) "color map".
When you edit such a file in Gimp, Gimp keeps it as color-indexed, and will coerce any color you use into the closest one in the color map (Gimp will not alter the color map on its own). This also applies to images you import in the project (
File>Open as layers..., cut/paste, drag & drop from other images in Gimp.
To avoid the problem, you can concert the initial image to full RGB mode (
Image>Mode>RGB). You then have the full color space available for editing.
- If you export to GIF again, the image will be color-indexed again so all the colors used will have to be shoe-horned into the 256 color map. Image degradation will likely ensue.
- A somewhat more recent variant of the GIF format allows one color-map per frame (while GIMP only supports the older one-map-per-animation), so even trivial editing of one image with Gimp can degrade it.
- The WebP format is supported by all modern browsers and removes most GIF restrictions.