Skip to content

Instantly share code, notes, and snippets.

@joeLepper
Created March 11, 2013 17:50
Show Gist options
  • Save joeLepper/5136157 to your computer and use it in GitHub Desktop.
Save joeLepper/5136157 to your computer and use it in GitHub Desktop.
var rectangle = { x : 0
, y : 0
, w : 10
, h : 10
, hugh : hue // 120
, satch : saturation // '50%'
, lite : light } // '50%'
, drawRec = function(recObj, modifyColor) {
// do some canvas setup stuff, then set the fill color...
if (modifyColor === 'undefined'){
canvasContext.fillStyle = 'hsl(' + recObj.hugh + ',' + recObj.satch + ',' + recObj.lite + ')';
}
else {
var moddedSatch = (parseInt(recObj.satch) - 10 ) + '%'
, moddedLite = (parseInt(recObj.satch) - 10 ) + '%'
canvasContext.fillStyle = 'hsl(' + recObj.hugh + ',' + moddedSatch + ',' + moddedLite + ')';
}
// draw some stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment