|
@@ -162,13 +162,14 @@ async function post(url = '', color = '000000') {
|
|
fd.append('color', color);
|
|
fd.append('color', color);
|
|
return await fetch(url, { method: 'POST', body: fd });
|
|
return await fetch(url, { method: 'POST', body: fd });
|
|
}
|
|
}
|
|
|
|
+function sg(x) { return Math.round((x*x)/255); }
|
|
function callback(red, green, blue) {
|
|
function callback(red, green, blue) {
|
|
console.log('logged', red, green, blue);
|
|
console.log('logged', red, green, blue);
|
|
post(
|
|
post(
|
|
/* url */ '',
|
|
/* url */ '',
|
|
- red.toString(16).padStart(2,'0') +
|
|
|
|
- green.toString(16).padStart(2,'0') +
|
|
|
|
- blue.toString(16).padStart(2,'0')
|
|
|
|
|
|
+ sg(red).toString(16).padStart(2,'0') +
|
|
|
|
+ sg(green).toString(16).padStart(2,'0') +
|
|
|
|
+ sg(blue).toString(16).padStart(2,'0')
|
|
).then((data) => { console.log(data, data.text()); });
|
|
).then((data) => { console.log(data, data.text()); });
|
|
}
|
|
}
|
|
canvas.removeEventListener('click', (event) => pick(event, selected));
|
|
canvas.removeEventListener('click', (event) => pick(event, selected));
|