The reason for the behaviour lies in the non-perceptive nature of the RGB distance equation. In the RGB space the distance is calculated as a Euclidian - so a root-mean square between the two RGB tuples. (In practice, the square-root is unnecessary and generally not coded, so that it is sum of squares that is minimised). For a given un-paletted colour a color distance is calculated to each color in the palette and the lowest value is considered "closest". In this case in RGB-space light green (130,190,40) is replaced by a light brown color RGB(166, 141, 95) because (130 - 166)^2 + (190 - 141)^2 + (40 - 95)^2 = 6722, while the visually closer colour RGB (144,238,144) is actually (130 - 144)^2 + (141 - 238)^2 + (40 - 144)^2 = 13316 - so it's further away in RGB-space. The difference in the blue value blows the Euclidian away, although in "reality" we don't see that difference as making a significant variation in colour.