Skip to content

Commit 83a4ece

Browse files
committed
Preserve locked colors during palette extraction
1 parent 27587a5 commit 83a4ece

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/components/PaletteGenerator.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,13 +579,26 @@ export const PaletteGenerator = GObject.registerClass(
579579
_extractColorsIM(imagePath) {
580580
this._showLoading(true);
581581

582+
// Get currently locked colors before extraction
583+
const lockedColors = this._swatchGrid.getLockedColors();
584+
const currentPalette = [...this._palette];
585+
582586
extractColorsFromWallpaperIM(
583587
imagePath,
584588
this._lightMode,
585589
colors => {
586-
this._originalPalette = [...colors];
587-
this.setPalette(colors);
588-
this.emit('palette-generated', colors);
590+
// Merge extracted colors with locked colors
591+
const mergedColors = colors.map((color, index) => {
592+
// Keep locked colors unchanged
593+
if (lockedColors[index] && currentPalette[index]) {
594+
return currentPalette[index];
595+
}
596+
return color;
597+
});
598+
599+
this._originalPalette = [...mergedColors];
600+
this.setPalette(mergedColors);
601+
this.emit('palette-generated', mergedColors);
589602
this._showLoading(false);
590603
},
591604
error => {

0 commit comments

Comments
 (0)