-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (21 loc) · 698 Bytes
/
script.js
File metadata and controls
26 lines (21 loc) · 698 Bytes
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
const ipc = require("electron").ipcRenderer;
ipc.send('start')
ipc.on('screenSize', (event, numRows, numCols) => {
const grid = document.getElementById('grid');
const row = document.createElement('div');
row.setAttribute('class', 'row');
grid.append(row);
[...Array(numCols + numRows + numRows - 2)].forEach((_, i) => {
const color = document.createElement('div');
color.setAttribute('class', 'color')
color.setAttribute('id', i);
row.append(color);
})
ipc.send('poll');
});
ipc.on('color', (event, colorData) => {
colorData.reverse().map((color, i) => {
const colorEl = document.getElementById(i);
colorEl.style.backgroundColor = "#" + color;
})
});