UNPKG

342 BJavaScriptView Raw
1const randomColor = () => {
2 return `rgb(${Math.random()*255}, ${Math.random()*255}, ${Math.random()*255})`
3}
4
5if (typeof registerPaint !== 'undefined') {
6 class RandomBg {
7 paint(ctx, size) {
8 ctx.fillStyle = randomColor()
9 ctx.fillRect(0, 0, size.width, size.height)
10 }
11 }
12
13 registerPaint('extra-randomBg', RandomBg)
14}
\No newline at end of file