rich mans border

by John kuoppala

HTML

<canvas id="canvas"></canvas>

JavaScript

var c = document.getElementById("canvas");
var ctx = c.getContext("2d");

function richMansBorder(x,y,w,h,lw,bc,bgc) {
    ctx.fillStyle=bc; //border color
    ctx.fillRect(x,y,w,h);
    
    ctx.fillStyle=bgc; //background color
    ctx.fillRect(x+lw,y+lw,w-lw*2,h-lw*2);
}

richMansBorder(50,50,100,50,1,"black","white");