Skip to content

Commit 07ffa05

Browse files
committed
feat: link colorBox to colorPicker #128
1 parent d0aeece commit 07ffa05

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

imgkit/features/image_layer_events.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ class ImageLayerEvents {
4848
y
4949
);
5050

51-
const color_name = await ImageProcessor.getColorName(color);
52-
5351
navigator.clipboard.writeText(color);
5452
// Send color to main renderer
55-
ipcRenderer.send("colorpickerValueSEND", color, color_name);
53+
ipcRenderer.send("colorpickerValueSEND", color);
5654
}
5755
});
5856

@@ -102,6 +100,7 @@ class ImageLayerEvents {
102100
const color = colorDiv.title;
103101
if (color && color !== "empty") {
104102
navigator.clipboard.writeText(color).then(() => {
103+
ipcRenderer.send("colorpickerValueSEND", color);
105104
ipcRenderer.send("showNotificationREQ", "imgkit-color-copy");
106105
});
107106
}

main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const {
1111
clipboard,
1212
nativeImage,
1313
} = electron;
14+
const { ImageProcessor } = require("./imgkit/processing/image_processor");
1415

1516
//electron refresh (only develop)
1617
if (process.env.NODE_ENV === "development") {
@@ -213,9 +214,9 @@ app.whenReady().then(() => {
213214
mainWindow.webContents.focus();
214215
});
215216

216-
ipcMain.on("colorpickerValueSEND", (event, color, color_name) => {
217+
ipcMain.on("colorpickerValueSEND", async (event, color) => {
217218
const views = mainWindow.getBrowserViews();
218-
219+
const color_name = await ImageProcessor.getColorName(color);
219220
views.forEach((view) => {
220221
view.webContents.send("colorpickerValueRECV", color, color_name);
221222
});

0 commit comments

Comments
 (0)