private void updatePalettes() {
		if (paletteType == PPUConstants.IMAGE_PALETTE_TYPE) {
			for (int i = 0; i < backgroundPalette.length; i++) {
				backgroundPalette[i] = (byte) EnvironmentUtilities.getIntegerEnvSetting(IMAGE_HELPER_BG_PALETTE_INDEX + i, DEFAULT_IMAGE_HELPER_BG_PALETTE);
			}
			for (int i = 0; i < spritePalette.length; i++) {
				if (i % 4 == 0) {
					spritePalette[i] = backgroundPalette[i];
				} else {
					spritePalette[i] = (byte) EnvironmentUtilities.getIntegerEnvSetting(IMAGE_HELPER_SPR_PALETTE_INDEX + i, DEFAULT_IMAGE_HELPER_SPR_PALETTE);
				}
			}
		} else {
			// give priority to the saved sprite palette for index 0
			for (int i = 0; i < spritePalette.length; i++) {
				spritePalette[i] = (byte) EnvironmentUtilities.getIntegerEnvSetting(IMAGE_HELPER_SPR_PALETTE_INDEX + i, DEFAULT_IMAGE_HELPER_SPR_PALETTE);
			}
			for (int i = 0; i < backgroundPalette.length; i++) {
				if (i % 4 == 0) {
					backgroundPalette[i] = spritePalette[i];
				} else {
					backgroundPalette[i] = (byte) EnvironmentUtilities.getIntegerEnvSetting(IMAGE_HELPER_BG_PALETTE_INDEX + i, DEFAULT_IMAGE_HELPER_BG_PALETTE);
				}
			}
		}

		if (palettePanel != null) {
			palettePanel.setVisibleSpritePaletteSize(spritePaletteSize, false);
			palettePanel.setVisibleImagePaletteSize(backgroundPaletteSize, false);
			palettePanel.resetPalette();
			resetDimensions();
		}
	}