(function(t) {
var s = function(t, s, r, i, e, o, h, c, n) {
this.el = t, this.sharp = !0, this.fs = n, this.filter = "", this.colours = {
c1: s,
c2: r,
c3: r,
shade: i,
alpha: c,
steps: e,
wheel: o,
light: ~~h
}, this.init()
};
s.prototype.init = function() {
if (this.cssPrefix = !1, t.browser.webkit ? this.cssPrefix = "-webkit" : t.browser.mozilla ? this.cssPrefix = "-moz" : t.browser.opera ? this.cssPrefix = "-o" : t.browser.msie && (this.cssPrefix = "-ms"), this.cssPrefix) {
for (var s = this.colours.steps; s > 0;) this.percents = this.percentage(), this.stringBuilder(), this.colourFilter(), s -= 1, s > 0 && (this.filter += ", ");
this.el.css("background-image", this.filter), this.fs && this.fit()
} else console.log("sorry bro, your browser isnt supported.")
}, s.prototype.stringBuilder = function() {
var t = this.colours,
s = this.catcol(t.c1),
r = this.catcol(t.c2),
i = this.catcol(t.c3),
e = this.catcol(t.shade),
o = ~~ (Math.random() * 360);
this.filter += this.cssPrefix + "-linear-gradient(" + o + "deg," + s + " " + this.percents.a + " ," + e + " " + this.percents.b + ", " + r + " " + this.percents.c + ", " + i + " " + this.percents.d + ")"
}, s.prototype.catcol = function(t) {
var s = "rgba(",
r = ")",
i = t.toString();
return s.concat(i).concat(r)
}, s.prototype.fit = function() {
this.el.css({
width: "100%",
height: window.innerHeight
})
}, s.prototype.percentage = function() {
var t = ~~ (Math.random() * 85),
s = t + ~~ (Math.random() * 15),
r = s,
i = 100 - s + ~~ (Math.random() * s),
e = {
a: t + "%",
b: s + "%",
c: r + "%",
d: i + "%"
};
return e
}, s.prototype.colourFilter = function() {
var t = this.colours;
t.c1 = this.colstep(t.c1), t.c1.push(t.alpha), t.c2 = this.colstep(t.c2), t.c2.push(t.alpha), t.c3 = this.colstep(t.c2), t.c3.push(t.alpha), t.shade = this.colstep(t.shade), t.shade.push(t.alpha)
}, s.prototype.colstep = function(t) {
var s = this.hsl(t),
r = this.colours.wheel,
i = 360 * r;
return this.colours.light > 3 && (this.colours.light = 3), s[0] = s[0] - ~~ (Math.random() * i / 2) + ~~ (Math.random() * i / 2), s[1] = 100 * r, s[2] = 30 * this.colours.light, this.rgb(s)
}, s.prototype.hsl = function(t) {
var s = t[0] / 255,
r = t[1] / 255,
i = t[2] / 255,
e = Math.max(s, r, i),
o = Math.min(s, r, i),
h = (e + o) / 2,
c = 0,
n = 0;
e != o && (c = .5 > h ? (e - o) / (e + o) : (e - o) / (2 - e - o), n = s == e ? (r - i) / (e - o) : r == e ? 2 + (i - s) / (e - o) : 4 + (s - r) / (e - o)), h = 100 * h, c = 100 * c, n = 60 * n, 0 > n && (n += 360);
var a = [n, c, h];
return a
}, s.prototype.rgb = function(t) {
var s, r, i, e, o, h, c = t[0],
n = t[1],
a = t[2];
return n /= 100, a /= 100, 0 == n ? e = o = h = 255 * a : (r = .5 >= a ? a * (n + 1) : a + n - a * n, s = 2 * a - r, i = c / 360, e = this.hue2rgb(s, r, i + 1 / 3), o = this.hue2rgb(s, r, i), h = this.hue2rgb(s, r, i - 1 / 3)), [Math.round(e), Math.round(o), Math.round(h)]
}, s.prototype.hue2rgb = function(t, s, r) {
var i;
return 0 > r ? r += 1 : r > 1 && (r -= 1), i = 1 > 6 * r ? t + 6 * (s - t) * r : 1 > 2 * r ? s : 2 > 3 * r ? t + 6 * (s - t) * (2 / 3 - r) : t, 255 * i
}, t.fn.shards = function(r, i, e, o, h, c, n, a) {
var l = t(this),
u = new s(l, r, i, e, o, h, c, n, a);
return a && t(window).resize(function() {
u.fit()
}), this.el
}
})(jQuery);
$('#foobar').shards([239,199,222,.0],[123,203,189,.0],[255,203,49,.0],20,.8,2,.15,true);
<div id="foobar"></div>