canvas = {
const width = 960
const height = 600
const padding = 20
const aspectRatio = 1/1.681
const ctx = DOM.context2d(width, height)
var bg = new Image()
bg.src = pattern + texselect
bg.alt = 'paper texture'
bg.onload = function() {
var texture = ctx.createPattern(bg, 'repeat')
ctx.fillStyle = texture
ctx.fillRect(padding, padding, (width - (2*padding)), (height - (2*padding)))
}
ctx.fillStyle = bgcol
ctx.fillRect(padding, padding, (width - (2*padding)), (height - (2*padding)))
ctx.rect(padding, padding, (width - (2*padding)), (height - (2*padding)))
ctx.stroke()
yield ctx.canvas
}