Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
gray bgs for apps with no hue
Browse files Browse the repository at this point in the history
  • Loading branch information
potch committed Feb 21, 2013
1 parent 244fec8 commit fa19417
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions media/js/mkt/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
var tile = el.querySelector('[data-hue]');
if (!tile) return;
var hue = +tile.getAttribute('data-hue');
if (!hue) return;
// if (!hue) return;
var canvas = el.querySelector('canvas') || document.createElement('canvas');
var cs = window.getComputedStyle(el, null);
var width = parseInt(cs.getPropertyValue('width'), 10);
Expand All @@ -15,8 +15,13 @@
canvas.height = height;
var ctx = canvas.getContext('2d');
var grad = ctx.createRadialGradient(width/2, height/2, 0, width/2, height/2, (width+height)/2.5);
grad.addColorStop(0, "hsl(" + hue + ",100%,85%)");
grad.addColorStop(1, "hsl(" + hue + ",75%,50%)");
if (hue) {
grad.addColorStop(0, "hsl(" + hue + ",100%,85%)");
grad.addColorStop(1, "hsl(" + hue + ",75%,50%)");
} else {
grad.addColorStop(0, "hsl(0,0%,94%)");
grad.addColorStop(1, "hsl(0,0%,80%)");
}
ctx.fillStyle = grad;
ctx.fillRect(0,0,width,height);
el.insertBefore(canvas, el.firstChild);
Expand Down

0 comments on commit fa19417

Please sign in to comment.