-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontentScript.js
41 lines (24 loc) · 951 Bytes
/
contentScript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.from === "popup" && message.query === "bright_eye_dropper_clicked") {
setTimeout(() => {
const eyeDropper = new EyeDropper();
eyeDropper.open().then(result => {
console.log(result);
chrome.storage.local.set({ "bright_color_hex_code": [result.sRGBHex] })
}).catch(e => {
console.log(e)
})
}, 500);
}
if (message.from === "popup" && message.query === "dark_eye_dropper_clicked") {
setTimeout(() => {
const eyeDropper = new EyeDropper();
eyeDropper.open().then(result => {
console.log(result);
chrome.storage.local.set({ "dark_color_hex_code": [result.sRGBHex] })
}).catch(e => {
console.log(e)
})
}, 500);
}
})