djmaze 2020-09-28 11:26:20 +02:00
parent 2d429297ad
commit 9b94265844

View file

@ -15,6 +15,7 @@ const doc = document,
ctrlKey = /Mac OS X/.test( navigator.userAgent ) ? '⌘ + ' : 'Ctrl + ', ctrlKey = /Mac OS X/.test( navigator.userAgent ) ? '⌘ + ' : 'Ctrl + ',
tpl = doc.createElement('template'), tpl = doc.createElement('template'),
clr = doc.createElement('input'),
getFragmentOfChildren = parent => { getFragmentOfChildren = parent => {
let frag = doc.createDocumentFragment(); let frag = doc.createDocumentFragment();
@ -138,6 +139,10 @@ const doc = document,
return text; return text;
}; };
clr.type = "color";
clr.style.display = 'none';
doc.body.append(clr);
class SquireUI class SquireUI
{ {
constructor(container) { constructor(container) {
@ -179,13 +184,19 @@ class SquireUI
}, },
colors: { colors: {
textColor: { textColor: {
input: 'color', html: 'A<sub>▾</sub>',
cmd: s => squire.setTextColour(s.value), cmd: () => {
clr.onchange = () => squire.setTextColour(clr.value);
clr.click();
},
hint: 'Text color' hint: 'Text color'
}, },
backgroundColor: { backgroundColor: {
input: 'color', html: '🎨', /* ▧ */
cmd: s => squire.setHighlightColour(s.value), cmd: () => {
clr.onchange = () => squire.setHighlightColour(clr.value);
clr.click();
},
hint: 'Background color' hint: 'Background color'
}, },
}, },