-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
23 lines (19 loc) · 781 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
window.onload = function () {
var $ = document.querySelector.bind(document)
function changecolors (e) {
$('#background').style.fill = $('#background-color').value
$('#foreground').style.fill = $('#foreground-color').value
var initials = $('#initials').value
$('#letter-left').textContent = initials[0] || '?'
$('#letter-middle').textContent =initials[1] || '?'
$('#letter-right').textContent = initials[2] || '?'
getimage()
}
function getimage() {
$('#download').href = 'data:image/svg+xml;base64,' + btoa($('svg').outerHTML)
}
$('#background-color').addEventListener("input", changecolors, false)
$('#foreground-color').addEventListener("input", changecolors, false)
$('#initials').onchange = changecolors
changecolors()
}