1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update icons

This commit is contained in:
Luke Pulverenti 2016-10-04 02:12:28 -04:00
parent cf3aa152cf
commit 7bc5a7a7e7
21 changed files with 1603 additions and 8 deletions

View file

@ -14,12 +14,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.285",
"_release": "1.4.285",
"version": "1.4.286",
"_release": "1.4.286",
"_resolution": {
"type": "version",
"tag": "1.4.285",
"commit": "832eef9023fe34ea838262763ca6f4b70e7b39ae"
"tag": "1.4.286",
"commit": "680a1d64f25542c11e035d4118c788ef68199e18"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.1",

View file

@ -215,9 +215,8 @@
}
.visualCardBox-cardFooter {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
border-bottom-left-radius: 1px;
border-bottom-right-radius: 1px;
}
.innerCardFooter {

View file

@ -152,7 +152,7 @@
.paper-icon-button-light > i {
width: auto;
height: auto;
font-size: 1.6em;
font-size: 1.5em;
/* Make sure its on top of the ripple */
position: relative;
z-index: 1;

View file

@ -0,0 +1,45 @@
{
"name": "vibrant",
"main": "dist/Vibrant.js",
"authors": [
"Jari Zwarts <jarizw@gmail.com>"
],
"description": "Get color variations from an image. Basically a JS port of Android's Palette",
"moduleType": [
"amd"
],
"keywords": [
"color",
"detection",
"variation",
"image",
"picture",
"canvas",
"vibrant",
"muted",
"colour"
],
"license": "MIT",
"homepage": "http://jari.io/",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {},
"devDependencies": {
"closure-compiler": "~0.2.6"
},
"_release": "3a3c848035",
"_resolution": {
"type": "branch",
"branch": "master",
"commit": "3a3c8480356c68ef96ced5b188ac3f3155504b57"
},
"_source": "https://github.com/jariz/vibrant.js.git",
"_target": "*",
"_originalSource": "vibrant",
"_direct": true
}

View file

@ -0,0 +1,19 @@
Copyright (c) 2015 Jari Zwarts
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -0,0 +1,35 @@
{
"name": "vibrant",
"main": "dist/Vibrant.js",
"authors": [
"Jari Zwarts <jarizw@gmail.com>"
],
"description": "Get color variations from an image. Basically a JS port of Android's Palette",
"moduleType": [
"amd"
],
"keywords": [
"color",
"detection",
"variation",
"image",
"picture",
"canvas",
"vibrant",
"muted",
"colour"
],
"license": "MIT",
"homepage": "http://jari.io/",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {},
"devDependencies": {
"closure-compiler": "~0.2.6"
}
}

View file

@ -0,0 +1,875 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/*
* quantize.js Copyright 2008 Nick Rabinowitz
* Ported to node.js by Olivier Lesnicki
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
*/
if (!pv) {
var pv = {
map: function(array, f) {
var o = {};
return f ? array.map(function(d, i) {
o.index = i;
return f.call(o, d);
}) : array.slice();
},
naturalOrder: function(a, b) {
return (a < b) ? -1 : ((a > b) ? 1 : 0);
},
sum: function(array, f) {
var o = {};
return array.reduce(f ? function(p, d, i) {
o.index = i;
return p + f.call(o, d);
} : function(p, d) {
return p + d;
}, 0);
},
max: function(array, f) {
return Math.max.apply(null, f ? pv.map(array, f) : array);
}
}
}
/**
* Basic Javascript port of the MMCQ (modified median cut quantization)
* algorithm from the Leptonica library (http://www.leptonica.com/).
* Returns a color map you can use to map original pixels to the reduced
* palette. Still a work in progress.
*
* @author Nick Rabinowitz
* @example
// array of pixels as [R,G,B] arrays
var myPixels = [[190,197,190], [202,204,200], [207,214,210], [211,214,211], [205,207,207]
// etc
];
var maxColors = 4;
var cmap = MMCQ.quantize(myPixels, maxColors);
var newPalette = cmap.palette();
var newPixels = myPixels.map(function(p) {
return cmap.map(p);
});
*/
var MMCQ = (function() {
// private constants
var sigbits = 5,
rshift = 8 - sigbits,
maxIterations = 1000,
fractByPopulations = 0.75;
// get reduced-space color index for a pixel
function getColorIndex(r, g, b) {
return (r << (2 * sigbits)) + (g << sigbits) + b;
}
// Simple priority queue
function PQueue(comparator) {
var contents = [],
sorted = false;
function sort() {
contents.sort(comparator);
sorted = true;
}
return {
push: function(o) {
contents.push(o);
sorted = false;
},
peek: function(index) {
if (!sorted) sort();
if (index === undefined) index = contents.length - 1;
return contents[index];
},
pop: function() {
if (!sorted) sort();
return contents.pop();
},
size: function() {
return contents.length;
},
map: function(f) {
return contents.map(f);
},
debug: function() {
if (!sorted) sort();
return contents;
}
};
}
// 3d color space box
function VBox(r1, r2, g1, g2, b1, b2, histo) {
var vbox = this;
vbox.r1 = r1;
vbox.r2 = r2;
vbox.g1 = g1;
vbox.g2 = g2;
vbox.b1 = b1;
vbox.b2 = b2;
vbox.histo = histo;
}
VBox.prototype = {
volume: function(force) {
var vbox = this;
if (!vbox._volume || force) {
vbox._volume = ((vbox.r2 - vbox.r1 + 1) * (vbox.g2 - vbox.g1 + 1) * (vbox.b2 - vbox.b1 + 1));
}
return vbox._volume;
},
count: function(force) {
var vbox = this,
histo = vbox.histo;
if (!vbox._count_set || force) {
var npix = 0,
i, j, k, index;
for (i = vbox.r1; i <= vbox.r2; i++) {
for (j = vbox.g1; j <= vbox.g2; j++) {
for (k = vbox.b1; k <= vbox.b2; k++) {
index = getColorIndex(i, j, k);
npix += (histo[index] || 0);
}
}
}
vbox._count = npix;
vbox._count_set = true;
}
return vbox._count;
},
copy: function() {
var vbox = this;
return new VBox(vbox.r1, vbox.r2, vbox.g1, vbox.g2, vbox.b1, vbox.b2, vbox.histo);
},
avg: function(force) {
var vbox = this,
histo = vbox.histo;
if (!vbox._avg || force) {
var ntot = 0,
mult = 1 << (8 - sigbits),
rsum = 0,
gsum = 0,
bsum = 0,
hval,
i, j, k, histoindex;
for (i = vbox.r1; i <= vbox.r2; i++) {
for (j = vbox.g1; j <= vbox.g2; j++) {
for (k = vbox.b1; k <= vbox.b2; k++) {
histoindex = getColorIndex(i, j, k);
hval = histo[histoindex] || 0;
ntot += hval;
rsum += (hval * (i + 0.5) * mult);
gsum += (hval * (j + 0.5) * mult);
bsum += (hval * (k + 0.5) * mult);
}
}
}
if (ntot) {
vbox._avg = [~~(rsum / ntot), ~~ (gsum / ntot), ~~ (bsum / ntot)];
} else {
//console.log('empty box');
vbox._avg = [~~(mult * (vbox.r1 + vbox.r2 + 1) / 2), ~~ (mult * (vbox.g1 + vbox.g2 + 1) / 2), ~~ (mult * (vbox.b1 + vbox.b2 + 1) / 2)];
}
}
return vbox._avg;
},
contains: function(pixel) {
var vbox = this,
rval = pixel[0] >> rshift;
gval = pixel[1] >> rshift;
bval = pixel[2] >> rshift;
return (rval >= vbox.r1 && rval <= vbox.r2 &&
gval >= vbox.g1 && gval <= vbox.g2 &&
bval >= vbox.b1 && bval <= vbox.b2);
}
};
// Color map
function CMap() {
this.vboxes = new PQueue(function(a, b) {
return pv.naturalOrder(
a.vbox.count() * a.vbox.volume(),
b.vbox.count() * b.vbox.volume()
)
});;
}
CMap.prototype = {
push: function(vbox) {
this.vboxes.push({
vbox: vbox,
color: vbox.avg()
});
},
palette: function() {
return this.vboxes.map(function(vb) {
return vb.color
});
},
size: function() {
return this.vboxes.size();
},
map: function(color) {
var vboxes = this.vboxes;
for (var i = 0; i < vboxes.size(); i++) {
if (vboxes.peek(i).vbox.contains(color)) {
return vboxes.peek(i).color;
}
}
return this.nearest(color);
},
nearest: function(color) {
var vboxes = this.vboxes,
d1, d2, pColor;
for (var i = 0; i < vboxes.size(); i++) {
d2 = Math.sqrt(
Math.pow(color[0] - vboxes.peek(i).color[0], 2) +
Math.pow(color[1] - vboxes.peek(i).color[1], 2) +
Math.pow(color[2] - vboxes.peek(i).color[2], 2)
);
if (d2 < d1 || d1 === undefined) {
d1 = d2;
pColor = vboxes.peek(i).color;
}
}
return pColor;
},
forcebw: function() {
// XXX: won't work yet
var vboxes = this.vboxes;
vboxes.sort(function(a, b) {
return pv.naturalOrder(pv.sum(a.color), pv.sum(b.color))
});
// force darkest color to black if everything < 5
var lowest = vboxes[0].color;
if (lowest[0] < 5 && lowest[1] < 5 && lowest[2] < 5)
vboxes[0].color = [0, 0, 0];
// force lightest color to white if everything > 251
var idx = vboxes.length - 1,
highest = vboxes[idx].color;
if (highest[0] > 251 && highest[1] > 251 && highest[2] > 251)
vboxes[idx].color = [255, 255, 255];
}
};
// histo (1-d array, giving the number of pixels in
// each quantized region of color space), or null on error
function getHisto(pixels) {
var histosize = 1 << (3 * sigbits),
histo = new Array(histosize),
index, rval, gval, bval;
pixels.forEach(function(pixel) {
rval = pixel[0] >> rshift;
gval = pixel[1] >> rshift;
bval = pixel[2] >> rshift;
index = getColorIndex(rval, gval, bval);
histo[index] = (histo[index] || 0) + 1;
});
return histo;
}
function vboxFromPixels(pixels, histo) {
var rmin = 1000000,
rmax = 0,
gmin = 1000000,
gmax = 0,
bmin = 1000000,
bmax = 0,
rval, gval, bval;
// find min/max
pixels.forEach(function(pixel) {
rval = pixel[0] >> rshift;
gval = pixel[1] >> rshift;
bval = pixel[2] >> rshift;
if (rval < rmin) rmin = rval;
else if (rval > rmax) rmax = rval;
if (gval < gmin) gmin = gval;
else if (gval > gmax) gmax = gval;
if (bval < bmin) bmin = bval;
else if (bval > bmax) bmax = bval;
});
return new VBox(rmin, rmax, gmin, gmax, bmin, bmax, histo);
}
function medianCutApply(histo, vbox) {
if (!vbox.count()) return;
var rw = vbox.r2 - vbox.r1 + 1,
gw = vbox.g2 - vbox.g1 + 1,
bw = vbox.b2 - vbox.b1 + 1,
maxw = pv.max([rw, gw, bw]);
// only one pixel, no split
if (vbox.count() == 1) {
return [vbox.copy()]
}
/* Find the partial sum arrays along the selected axis. */
var total = 0,
partialsum = [],
lookaheadsum = [],
i, j, k, sum, index;
if (maxw == rw) {
for (i = vbox.r1; i <= vbox.r2; i++) {
sum = 0;
for (j = vbox.g1; j <= vbox.g2; j++) {
for (k = vbox.b1; k <= vbox.b2; k++) {
index = getColorIndex(i, j, k);
sum += (histo[index] || 0);
}
}
total += sum;
partialsum[i] = total;
}
} else if (maxw == gw) {
for (i = vbox.g1; i <= vbox.g2; i++) {
sum = 0;
for (j = vbox.r1; j <= vbox.r2; j++) {
for (k = vbox.b1; k <= vbox.b2; k++) {
index = getColorIndex(j, i, k);
sum += (histo[index] || 0);
}
}
total += sum;
partialsum[i] = total;
}
} else { /* maxw == bw */
for (i = vbox.b1; i <= vbox.b2; i++) {
sum = 0;
for (j = vbox.r1; j <= vbox.r2; j++) {
for (k = vbox.g1; k <= vbox.g2; k++) {
index = getColorIndex(j, k, i);
sum += (histo[index] || 0);
}
}
total += sum;
partialsum[i] = total;
}
}
partialsum.forEach(function(d, i) {
lookaheadsum[i] = total - d
});
function doCut(color) {
var dim1 = color + '1',
dim2 = color + '2',
left, right, vbox1, vbox2, d2, count2 = 0;
for (i = vbox[dim1]; i <= vbox[dim2]; i++) {
if (partialsum[i] > total / 2) {
vbox1 = vbox.copy();
vbox2 = vbox.copy();
left = i - vbox[dim1];
right = vbox[dim2] - i;
if (left <= right)
d2 = Math.min(vbox[dim2] - 1, ~~ (i + right / 2));
else d2 = Math.max(vbox[dim1], ~~ (i - 1 - left / 2));
// avoid 0-count boxes
while (!partialsum[d2]) d2++;
count2 = lookaheadsum[d2];
while (!count2 && partialsum[d2 - 1]) count2 = lookaheadsum[--d2];
// set dimensions
vbox1[dim2] = d2;
vbox2[dim1] = vbox1[dim2] + 1;
// console.log('vbox counts:', vbox.count(), vbox1.count(), vbox2.count());
return [vbox1, vbox2];
}
}
}
// determine the cut planes
return maxw == rw ? doCut('r') :
maxw == gw ? doCut('g') :
doCut('b');
}
function quantize(pixels, maxcolors) {
// short-circuit
if (!pixels.length || maxcolors < 2 || maxcolors > 256) {
// console.log('wrong number of maxcolors');
return false;
}
// XXX: check color content and convert to grayscale if insufficient
var histo = getHisto(pixels),
histosize = 1 << (3 * sigbits);
// check that we aren't below maxcolors already
var nColors = 0;
histo.forEach(function() {
nColors++
});
if (nColors <= maxcolors) {
// XXX: generate the new colors from the histo and return
}
// get the beginning vbox from the colors
var vbox = vboxFromPixels(pixels, histo),
pq = new PQueue(function(a, b) {
return pv.naturalOrder(a.count(), b.count())
});
pq.push(vbox);
// inner function to do the iteration
function iter(lh, target) {
var ncolors = 1,
niters = 0,
vbox;
while (niters < maxIterations) {
vbox = lh.pop();
if (!vbox.count()) { /* just put it back */
lh.push(vbox);
niters++;
continue;
}
// do the cut
var vboxes = medianCutApply(histo, vbox),
vbox1 = vboxes[0],
vbox2 = vboxes[1];
if (!vbox1) {
// console.log("vbox1 not defined; shouldn't happen!");
return;
}
lh.push(vbox1);
if (vbox2) { /* vbox2 can be null */
lh.push(vbox2);
ncolors++;
}
if (ncolors >= target) return;
if (niters++ > maxIterations) {
// console.log("infinite loop; perhaps too few pixels!");
return;
}
}
}
// first set of colors, sorted by population
iter(pq, fractByPopulations * maxcolors);
// console.log(pq.size(), pq.debug().length, pq.debug().slice());
// Re-sort by the product of pixel occupancy times the size in color space.
var pq2 = new PQueue(function(a, b) {
return pv.naturalOrder(a.count() * a.volume(), b.count() * b.volume())
});
while (pq.size()) {
pq2.push(pq.pop());
}
// next set - generate the median cuts using the (npix * vol) sorting.
iter(pq2, maxcolors - pq2.size());
// calculate the actual colors
var cmap = new CMap();
while (pq2.size()) {
cmap.push(pq2.pop());
}
return cmap;
}
return {
quantize: quantize
}
})();
module.exports = MMCQ.quantize
},{}],2:[function(require,module,exports){
/*
Vibrant.js
by Jari Zwarts
Color algorithm class that finds variations on colors in an image.
Credits
--------
Lokesh Dhakar (http://www.lokeshdhakar.com) - Created ColorThief
Google - Palette support library in Android
*/
(function() {
var CanvasImage, Swatch, Vibrant,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
slice = [].slice;
window.Swatch = Swatch = (function() {
Swatch.prototype.hsl = void 0;
Swatch.prototype.rgb = void 0;
Swatch.prototype.population = 1;
Swatch.yiq = 0;
function Swatch(rgb, population) {
this.rgb = rgb;
this.population = population;
}
Swatch.prototype.getHsl = function() {
if (!this.hsl) {
return this.hsl = Vibrant.rgbToHsl(this.rgb[0], this.rgb[1], this.rgb[2]);
} else {
return this.hsl;
}
};
Swatch.prototype.getPopulation = function() {
return this.population;
};
Swatch.prototype.getRgb = function() {
return this.rgb;
};
Swatch.prototype.getHex = function() {
return "#" + ((1 << 24) + (this.rgb[0] << 16) + (this.rgb[1] << 8) + this.rgb[2]).toString(16).slice(1, 7);
};
Swatch.prototype.getTitleTextColor = function() {
this._ensureTextColors();
if (this.yiq < 200) {
return "#fff";
} else {
return "#000";
}
};
Swatch.prototype.getBodyTextColor = function() {
this._ensureTextColors();
if (this.yiq < 150) {
return "#fff";
} else {
return "#000";
}
};
Swatch.prototype._ensureTextColors = function() {
if (!this.yiq) {
return this.yiq = (this.rgb[0] * 299 + this.rgb[1] * 587 + this.rgb[2] * 114) / 1000;
}
};
return Swatch;
})();
window.Vibrant = Vibrant = (function() {
Vibrant.prototype.quantize = require('quantize');
Vibrant.prototype._swatches = [];
Vibrant.prototype.TARGET_DARK_LUMA = 0.26;
Vibrant.prototype.MAX_DARK_LUMA = 0.45;
Vibrant.prototype.MIN_LIGHT_LUMA = 0.55;
Vibrant.prototype.TARGET_LIGHT_LUMA = 0.74;
Vibrant.prototype.MIN_NORMAL_LUMA = 0.3;
Vibrant.prototype.TARGET_NORMAL_LUMA = 0.5;
Vibrant.prototype.MAX_NORMAL_LUMA = 0.7;
Vibrant.prototype.TARGET_MUTED_SATURATION = 0.3;
Vibrant.prototype.MAX_MUTED_SATURATION = 0.4;
Vibrant.prototype.TARGET_VIBRANT_SATURATION = 1;
Vibrant.prototype.MIN_VIBRANT_SATURATION = 0.35;
Vibrant.prototype.WEIGHT_SATURATION = 3;
Vibrant.prototype.WEIGHT_LUMA = 6;
Vibrant.prototype.WEIGHT_POPULATION = 1;
Vibrant.prototype.VibrantSwatch = void 0;
Vibrant.prototype.MutedSwatch = void 0;
Vibrant.prototype.DarkVibrantSwatch = void 0;
Vibrant.prototype.DarkMutedSwatch = void 0;
Vibrant.prototype.LightVibrantSwatch = void 0;
Vibrant.prototype.LightMutedSwatch = void 0;
Vibrant.prototype.HighestPopulation = 0;
function Vibrant(sourceImage, colorCount, quality) {
this.swatches = bind(this.swatches, this);
var a, allPixels, b, cmap, g, i, image, imageData, offset, pixelCount, pixels, r;
if (typeof colorCount === 'undefined') {
colorCount = 64;
}
if (typeof quality === 'undefined') {
quality = 5;
}
image = new CanvasImage(sourceImage);
try {
imageData = image.getImageData();
pixels = imageData.data;
pixelCount = image.getPixelCount();
allPixels = [];
i = 0;
while (i < pixelCount) {
offset = i * 4;
r = pixels[offset + 0];
g = pixels[offset + 1];
b = pixels[offset + 2];
a = pixels[offset + 3];
if (a >= 125) {
if (!(r > 250 && g > 250 && b > 250)) {
allPixels.push([r, g, b]);
}
}
i = i + quality;
}
cmap = this.quantize(allPixels, colorCount);
this._swatches = cmap.vboxes.map((function(_this) {
return function(vbox) {
return new Swatch(vbox.color, vbox.vbox.count());
};
})(this));
this.maxPopulation = this.findMaxPopulation;
this.generateVarationColors();
this.generateEmptySwatches();
} finally {
image.removeCanvas();
}
}
Vibrant.prototype.generateVarationColors = function() {
this.VibrantSwatch = this.findColorVariation(this.TARGET_NORMAL_LUMA, this.MIN_NORMAL_LUMA, this.MAX_NORMAL_LUMA, this.TARGET_VIBRANT_SATURATION, this.MIN_VIBRANT_SATURATION, 1);
this.LightVibrantSwatch = this.findColorVariation(this.TARGET_LIGHT_LUMA, this.MIN_LIGHT_LUMA, 1, this.TARGET_VIBRANT_SATURATION, this.MIN_VIBRANT_SATURATION, 1);
this.DarkVibrantSwatch = this.findColorVariation(this.TARGET_DARK_LUMA, 0, this.MAX_DARK_LUMA, this.TARGET_VIBRANT_SATURATION, this.MIN_VIBRANT_SATURATION, 1);
this.MutedSwatch = this.findColorVariation(this.TARGET_NORMAL_LUMA, this.MIN_NORMAL_LUMA, this.MAX_NORMAL_LUMA, this.TARGET_MUTED_SATURATION, 0, this.MAX_MUTED_SATURATION);
this.LightMutedSwatch = this.findColorVariation(this.TARGET_LIGHT_LUMA, this.MIN_LIGHT_LUMA, 1, this.TARGET_MUTED_SATURATION, 0, this.MAX_MUTED_SATURATION);
return this.DarkMutedSwatch = this.findColorVariation(this.TARGET_DARK_LUMA, 0, this.MAX_DARK_LUMA, this.TARGET_MUTED_SATURATION, 0, this.MAX_MUTED_SATURATION);
};
Vibrant.prototype.generateEmptySwatches = function() {
var hsl;
if (this.VibrantSwatch === void 0) {
if (this.DarkVibrantSwatch !== void 0) {
hsl = this.DarkVibrantSwatch.getHsl();
hsl[2] = this.TARGET_NORMAL_LUMA;
this.VibrantSwatch = new Swatch(Vibrant.hslToRgb(hsl[0], hsl[1], hsl[2]), 0);
}
}
if (this.DarkVibrantSwatch === void 0) {
if (this.VibrantSwatch !== void 0) {
hsl = this.VibrantSwatch.getHsl();
hsl[2] = this.TARGET_DARK_LUMA;
return this.DarkVibrantSwatch = new Swatch(Vibrant.hslToRgb(hsl[0], hsl[1], hsl[2]), 0);
}
}
};
Vibrant.prototype.findMaxPopulation = function() {
var j, len, population, ref, swatch;
population = 0;
ref = this._swatches;
for (j = 0, len = ref.length; j < len; j++) {
swatch = ref[j];
population = Math.max(population, swatch.getPopulation());
}
return population;
};
Vibrant.prototype.findColorVariation = function(targetLuma, minLuma, maxLuma, targetSaturation, minSaturation, maxSaturation) {
var j, len, luma, max, maxValue, ref, sat, swatch, value;
max = void 0;
maxValue = 0;
ref = this._swatches;
for (j = 0, len = ref.length; j < len; j++) {
swatch = ref[j];
sat = swatch.getHsl()[1];
luma = swatch.getHsl()[2];
if (sat >= minSaturation && sat <= maxSaturation && luma >= minLuma && luma <= maxLuma && !this.isAlreadySelected(swatch)) {
value = this.createComparisonValue(sat, targetSaturation, luma, targetLuma, swatch.getPopulation(), this.HighestPopulation);
if (max === void 0 || value > maxValue) {
max = swatch;
maxValue = value;
}
}
}
return max;
};
Vibrant.prototype.createComparisonValue = function(saturation, targetSaturation, luma, targetLuma, population, maxPopulation) {
return this.weightedMean(this.invertDiff(saturation, targetSaturation), this.WEIGHT_SATURATION, this.invertDiff(luma, targetLuma), this.WEIGHT_LUMA, population / maxPopulation, this.WEIGHT_POPULATION);
};
Vibrant.prototype.invertDiff = function(value, targetValue) {
return 1 - Math.abs(value - targetValue);
};
Vibrant.prototype.weightedMean = function() {
var i, sum, sumWeight, value, values, weight;
values = 1 <= arguments.length ? slice.call(arguments, 0) : [];
sum = 0;
sumWeight = 0;
i = 0;
while (i < values.length) {
value = values[i];
weight = values[i + 1];
sum += value * weight;
sumWeight += weight;
i += 2;
}
return sum / sumWeight;
};
Vibrant.prototype.swatches = function() {
return {
Vibrant: this.VibrantSwatch,
Muted: this.MutedSwatch,
DarkVibrant: this.DarkVibrantSwatch,
DarkMuted: this.DarkMutedSwatch,
LightVibrant: this.LightVibrantSwatch,
LightMuted: this.LightMuted
};
};
Vibrant.prototype.isAlreadySelected = function(swatch) {
return this.VibrantSwatch === swatch || this.DarkVibrantSwatch === swatch || this.LightVibrantSwatch === swatch || this.MutedSwatch === swatch || this.DarkMutedSwatch === swatch || this.LightMutedSwatch === swatch;
};
Vibrant.rgbToHsl = function(r, g, b) {
var d, h, l, max, min, s;
r /= 255;
g /= 255;
b /= 255;
max = Math.max(r, g, b);
min = Math.min(r, g, b);
h = void 0;
s = void 0;
l = (max + min) / 2;
if (max === min) {
h = s = 0;
} else {
d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
}
h /= 6;
}
return [h, s, l];
};
Vibrant.hslToRgb = function(h, s, l) {
var b, g, hue2rgb, p, q, r;
r = void 0;
g = void 0;
b = void 0;
hue2rgb = function(p, q, t) {
if (t < 0) {
t += 1;
}
if (t > 1) {
t -= 1;
}
if (t < 1 / 6) {
return p + (q - p) * 6 * t;
}
if (t < 1 / 2) {
return q;
}
if (t < 2 / 3) {
return p + (q - p) * (2 / 3 - t) * 6;
}
return p;
};
if (s === 0) {
r = g = b = l;
} else {
q = l < 0.5 ? l * (1 + s) : l + s - (l * s);
p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - (1 / 3));
}
return [r * 255, g * 255, b * 255];
};
return Vibrant;
})();
/*
CanvasImage Class
Class that wraps the html image element and canvas.
It also simplifies some of the canvas context manipulation
with a set of helper functions.
Stolen from https://github.com/lokesh/color-thief
*/
window.CanvasImage = CanvasImage = (function() {
function CanvasImage(image) {
this.canvas = document.createElement('canvas');
this.context = this.canvas.getContext('2d');
document.body.appendChild(this.canvas);
this.width = this.canvas.width = image.width;
this.height = this.canvas.height = image.height;
this.context.drawImage(image, 0, 0, this.width, this.height);
}
CanvasImage.prototype.clear = function() {
return this.context.clearRect(0, 0, this.width, this.height);
};
CanvasImage.prototype.update = function(imageData) {
return this.context.putImageData(imageData, 0, 0);
};
CanvasImage.prototype.getPixelCount = function() {
return this.width * this.height;
};
CanvasImage.prototype.getImageData = function() {
return this.context.getImageData(0, 0, this.width, this.height);
};
CanvasImage.prototype.removeCanvas = function() {
return this.canvas.parentNode.removeChild(this.canvas);
};
return CanvasImage;
})();
}).call(this);
},{"quantize":1}]},{},[2]);

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

View file

@ -0,0 +1,42 @@
gulp = require 'gulp'
coffee = require 'gulp-coffee'
browserify = require 'browserify'
runSequence = require 'run-sequence'
source = require 'vinyl-source-stream'
del = require 'del'
closureCompiler = require 'gulp-closure-compiler'
gulp.task 'coffee', ->
gulp.src('*.coffee')
.pipe(coffee())
.pipe(gulp.dest('.'))
gulp.src('src/*.coffee')
.pipe(coffee())
.pipe(gulp.dest('src'))
gulp.task 'browserify', ->
browserify(
entries: 'src/Vibrant.js'
)
.bundle()
.pipe(source('Vibrant.js'))
.pipe(gulp.dest('dist'))
gulp.task 'default', ->
runSequence 'coffee', 'browserify', 'cleanup', 'closure'
gulp.task 'cleanup', (cb) ->
del ['src/Vibrant.js'], cb
gulp.task 'closure', ->
gulp.src('dist/Vibrant.js')
.pipe(closureCompiler(
compilerPath: 'bower_components/closure-compiler/lib/vendor/compiler.jar',
fileName: 'Vibrant.min.js',
continueWithWarnings: true
))
.pipe(gulp.dest('dist'));
gulp.task 'watch', ->
gulp.watch ['**/*.coffee'], ['default']

View file

@ -0,0 +1,162 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Vibrant.js - Extract prominent colors from an image.</title>
<script src="dist/Vibrant.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.3.0/css/material.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
<script src="website.js"></script>
<!-- Open graph metadata -->
<meta property="og:title" content="Vibrant"/>
<meta property="og:url" content="https://jariz.github.io/vibrant.js/"/>
<meta property="og:image" content="https://jariz.github.io/vibrant.js/examples/og.png"/>
<meta property="og:site_name" content="Vibrant"/>
<meta property="og:description" content="Extract prominent colors from an image."/>
<meta property="og:type" content="website"/>
</head>
<body>
<div class="navbar navbar-white navbar-fixed">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://jariz.github.io/vibrant.js/">Vibrant.js</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<a target="_blank" href="http://github.com/jariz/vibrant.js/" class="btn btn-success btn-raised navbar-btn">Get it</a>
</ul>
</div>
</div>
</div>
<div class="container">
<h1>Vibrant.js</h1>
<p>Extract prominent colors from an image.<br>Vibrant.js is a javascript port of the <a href="https://developer.android.com/reference/android/support/v7/graphics/Palette.html">awesome Palette class</a> in the Android support library.</p>
<h3 id="showcase">Showcase</h3>
<div class="row examples">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
<img data-src="examples/3.jpg">
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
<img data-src="examples/4.jpg">
</div>
</div>
</div>
</div>
<div class="row examples">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
<img data-src="examples/2.jpg">
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
<img data-src="examples/1.jpg">
</div>
</div>
</div>
</div>
<h3>API</h3>
<p>Use of Vibrant is pretty straight forward, but because code works better than explanation, here's an example:</p>
<!--<a class="btn btn-raised pull-right btn-success">Run</a>-->
<pre class="prettyprint">
var img = document.createElement('img');
img.setAttribute('src', 'examples/octocat.png')
img.addEventListener('load', function() {
var vibrant = new Vibrant(img);
var swatches = vibrant.swatches()
for (var swatch in swatches)
if (swatches.hasOwnProperty(swatch) && swatches[swatch])
console.log(swatch, swatches[swatch].getHex())
/*
* Results into:
* Vibrant #7a4426
* Muted #7b9eae
* DarkVibrant #348945
* DarkMuted #141414
* LightVibrant #f3ccb4
*/
});
</pre>
<p>As you can see, Vibrant's first argument is an image. Make sure it's loaded before passing it off to Vibrant.<br>Vibrant has 3 constructor parameters:</p>
<pre class="prettyprint">
new Vibrant(
img,
64, /* amount of colors in initial palette from which the swatches will be generated, defaults to 64 */
5 /* quality. 0 is highest, but takes way more processing. defaults to 5. */
)
</pre>
<h4 style="margin-top:20px">The Swatch class</h4>
<p>Vibrant.swatch() returns a object with Swatch objects.
<br><strong>Note that some Swatches might be set to 'undefined' when Vibrant fails to find a matching color for the profile!</strong>
<br>A Swatch can be used to get the swatch's color (in RGB and hex), what text color works best with this color, and more.</p>
<table class="table">
<thead>
<tr>
<th>Function name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>new Swatch()</td>
<td>Initialize a new swatch. First argument needs to be an RGB array, second argument must be the swatch' population.</td>
</tr>
<tr>
<td>.getRgb()</td>
<td>Get swatch color in a RGB array</td>
</tr>
<tr>
<td>.getHex()</td>
<td>Get swatch color in hex format (#EE22DD)</td>
</tr>
<tr>
<td>.getHsl()</td>
<td>Get swatch color in a HSL array</td>
</tr>
<tr>
<td>.getPopulation()</td>
<td>Get population (amount of times this color was used in the original image)</td>
</tr>
<tr>
<td>.getTitleTextColor()</td>
<td>Get a color (in hex) that works best with any 'title' text that is used over this swatch's color</td>
</tr>
<tr>
<td>.getBodyTextColor()</td>
<td>Get a color (in hex) that works best with any 'body' text that is used over this swatch's color</td>
</tr>
</tbody>
</table>
</div>
<div class="well-material-light-green footer">
<div class="container">
<div class="pull-left">Another one of <a href="http://jari.io/">Jari's</a> weird projects.</div>
<div class="pull-right">Like material design? <a href="http://tabbie.io">Check out Tabbie!</a></div>
</div>
</div>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=desert"></script>
</body>
</html>

View file

@ -0,0 +1,44 @@
{
"name": "vibrant",
"version": "1.0.0",
"description": "Get color variations from an image. Basically a JS port of Android's Palette",
"main": "src/Vibrant.js",
"directories": {
"example": "examples"
},
"dependencies": {},
"devDependencies": {
"browserify": "^10.2.1",
"gulp": "^3.8.11",
"gulp-closure-compiler": "^0.2.19",
"gulp-coffee": "^2.3.1",
"quantize": "^1.0.2",
"run-sequence": "^1.1.0",
"vinyl-source-stream": "^1.1.0",
"del": "^1.2.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/jariz/vibrant.js.git"
},
"keywords": [
"color",
"detection",
"varation",
"image",
"picture",
"canvas",
"vibrant",
"muted",
"colour"
],
"author": "Jari Zwarts",
"license": "MIT",
"bugs": {
"url": "https://github.com/jariz/vibrant.js/issues"
},
"homepage": "https://github.com/jariz/vibrant.js"
}

View file

@ -0,0 +1,307 @@
###
Vibrant.js
by Jari Zwarts
Color algorithm class that finds variations on colors in an image.
Credits
--------
Lokesh Dhakar (http://www.lokeshdhakar.com) - Created ColorThief
Google - Palette support library in Android
###
window.Swatch = class Swatch
hsl: undefined
rgb: undefined
population: 1
@yiq: 0
constructor: (rgb, population) ->
@rgb = rgb
@population = population
getHsl: ->
if not @hsl
@hsl = Vibrant.rgbToHsl @rgb[0], @rgb[1], @rgb[2]
else @hsl
getPopulation: ->
@population
getRgb: ->
@rgb
getHex: ->
"#" + ((1 << 24) + (@rgb[0] << 16) + (@rgb[1] << 8) + @rgb[2]).toString(16).slice(1, 7);
getTitleTextColor: ->
@_ensureTextColors()
if @yiq < 200 then "#fff" else "#000"
getBodyTextColor: ->
@_ensureTextColors()
if @yiq < 150 then "#fff" else "#000"
_ensureTextColors: ->
if not @yiq then @yiq = (@rgb[0] * 299 + @rgb[1] * 587 + @rgb[2] * 114) / 1000
window.Vibrant = class Vibrant
quantize: require('quantize')
_swatches: []
TARGET_DARK_LUMA: 0.26
MAX_DARK_LUMA: 0.45
MIN_LIGHT_LUMA: 0.55
TARGET_LIGHT_LUMA: 0.74
MIN_NORMAL_LUMA: 0.3
TARGET_NORMAL_LUMA: 0.5
MAX_NORMAL_LUMA: 0.7
TARGET_MUTED_SATURATION: 0.3
MAX_MUTED_SATURATION: 0.4
TARGET_VIBRANT_SATURATION: 1
MIN_VIBRANT_SATURATION: 0.35
WEIGHT_SATURATION: 3
WEIGHT_LUMA: 6
WEIGHT_POPULATION: 1
VibrantSwatch: undefined
MutedSwatch: undefined
DarkVibrantSwatch: undefined
DarkMutedSwatch: undefined
LightVibrantSwatch: undefined
LightMutedSwatch: undefined
HighestPopulation: 0
constructor: (sourceImage, colorCount, quality) ->
if typeof colorCount == 'undefined'
colorCount = 64
if typeof quality == 'undefined'
quality = 5
image = new CanvasImage(sourceImage)
try
imageData = image.getImageData()
pixels = imageData.data
pixelCount = image.getPixelCount()
allPixels = []
i = 0
while i < pixelCount
offset = i * 4
r = pixels[offset + 0]
g = pixels[offset + 1]
b = pixels[offset + 2]
a = pixels[offset + 3]
# If pixel is mostly opaque and not white
if a >= 125
if not (r > 250 and g > 250 and b > 250)
allPixels.push [r, g, b]
i = i + quality
cmap = @quantize allPixels, colorCount
@_swatches = cmap.vboxes.map (vbox) =>
new Swatch vbox.color, vbox.vbox.count()
@maxPopulation = @findMaxPopulation
@generateVarationColors()
@generateEmptySwatches()
# Clean up
finally
image.removeCanvas()
generateVarationColors: ->
@VibrantSwatch = @findColorVariation(@TARGET_NORMAL_LUMA, @MIN_NORMAL_LUMA, @MAX_NORMAL_LUMA,
@TARGET_VIBRANT_SATURATION, @MIN_VIBRANT_SATURATION, 1);
@LightVibrantSwatch = @findColorVariation(@TARGET_LIGHT_LUMA, @MIN_LIGHT_LUMA, 1,
@TARGET_VIBRANT_SATURATION, @MIN_VIBRANT_SATURATION, 1);
@DarkVibrantSwatch = @findColorVariation(@TARGET_DARK_LUMA, 0, @MAX_DARK_LUMA,
@TARGET_VIBRANT_SATURATION, @MIN_VIBRANT_SATURATION, 1);
@MutedSwatch = @findColorVariation(@TARGET_NORMAL_LUMA, @MIN_NORMAL_LUMA, @MAX_NORMAL_LUMA,
@TARGET_MUTED_SATURATION, 0, @MAX_MUTED_SATURATION);
@LightMutedSwatch = @findColorVariation(@TARGET_LIGHT_LUMA, @MIN_LIGHT_LUMA, 1,
@TARGET_MUTED_SATURATION, 0, @MAX_MUTED_SATURATION);
@DarkMutedSwatch = @findColorVariation(@TARGET_DARK_LUMA, 0, @MAX_DARK_LUMA,
@TARGET_MUTED_SATURATION, 0, @MAX_MUTED_SATURATION);
generateEmptySwatches: ->
if @VibrantSwatch is undefined
# If we do not have a vibrant color...
if @DarkVibrantSwatch isnt undefined
# ...but we do have a dark vibrant, generate the value by modifying the luma
hsl = @DarkVibrantSwatch.getHsl()
hsl[2] = @TARGET_NORMAL_LUMA
@VibrantSwatch = new Swatch Vibrant.hslToRgb(hsl[0], hsl[1], hsl[2]), 0
if @DarkVibrantSwatch is undefined
# If we do not have a vibrant color...
if @VibrantSwatch isnt undefined
# ...but we do have a dark vibrant, generate the value by modifying the luma
hsl = @VibrantSwatch.getHsl()
hsl[2] = @TARGET_DARK_LUMA
@DarkVibrantSwatch = new Swatch Vibrant.hslToRgb(hsl[0], hsl[1], hsl[2]), 0
findMaxPopulation: ->
population = 0
population = Math.max(population, swatch.getPopulation()) for swatch in @_swatches
population
findColorVariation: (targetLuma, minLuma, maxLuma, targetSaturation, minSaturation, maxSaturation) ->
max = undefined
maxValue = 0
for swatch in @_swatches
sat = swatch.getHsl()[1];
luma = swatch.getHsl()[2]
if sat >= minSaturation and sat <= maxSaturation and
luma >= minLuma and luma <= maxLuma and
not @isAlreadySelected(swatch)
value = @createComparisonValue sat, targetSaturation, luma, targetLuma,
swatch.getPopulation(), @HighestPopulation
if max is undefined or value > maxValue
max = swatch
maxValue = value
max
createComparisonValue: (saturation, targetSaturation,
luma, targetLuma, population, maxPopulation) ->
@weightedMean(
@invertDiff(saturation, targetSaturation), @WEIGHT_SATURATION,
@invertDiff(luma, targetLuma), @WEIGHT_LUMA,
population / maxPopulation, @WEIGHT_POPULATION
)
invertDiff: (value, targetValue) ->
1 - Math.abs value - targetValue
weightedMean: (values...) ->
sum = 0
sumWeight = 0
i = 0
while i < values.length
value = values[i]
weight = values[i + 1]
sum += value * weight
sumWeight += weight
i += 2
sum / sumWeight
swatches: =>
Vibrant: @VibrantSwatch
Muted: @MutedSwatch
DarkVibrant: @DarkVibrantSwatch
DarkMuted: @DarkMutedSwatch
LightVibrant: @LightVibrantSwatch
LightMuted: @LightMuted
isAlreadySelected: (swatch) ->
@VibrantSwatch is swatch or @DarkVibrantSwatch is swatch or
@LightVibrantSwatch is swatch or @MutedSwatch is swatch or
@DarkMutedSwatch is swatch or @LightMutedSwatch is swatch
@rgbToHsl: (r, g, b) ->
r /= 255
g /= 255
b /= 255
max = Math.max(r, g, b)
min = Math.min(r, g, b)
h = undefined
s = undefined
l = (max + min) / 2
if max == min
h = s = 0
# achromatic
else
d = max - min
s = if l > 0.5 then d / (2 - max - min) else d / (max + min)
switch max
when r
h = (g - b) / d + (if g < b then 6 else 0)
when g
h = (b - r) / d + 2
when b
h = (r - g) / d + 4
h /= 6
[h, s, l]
@hslToRgb: (h, s, l) ->
r = undefined
g = undefined
b = undefined
hue2rgb = (p, q, t) ->
if t < 0
t += 1
if t > 1
t -= 1
if t < 1 / 6
return p + (q - p) * 6 * t
if t < 1 / 2
return q
if t < 2 / 3
return p + (q - p) * (2 / 3 - t) * 6
p
if s == 0
r = g = b = l
# achromatic
else
q = if l < 0.5 then l * (1 + s) else l + s - (l * s)
p = 2 * l - q
r = hue2rgb(p, q, h + 1 / 3)
g = hue2rgb(p, q, h)
b = hue2rgb(p, q, h - (1 / 3))
[
r * 255
g * 255
b * 255
]
###
CanvasImage Class
Class that wraps the html image element and canvas.
It also simplifies some of the canvas context manipulation
with a set of helper functions.
Stolen from https://github.com/lokesh/color-thief
###
window.CanvasImage = class CanvasImage
constructor: (image) ->
@canvas = document.createElement('canvas')
@context = @canvas.getContext('2d')
document.body.appendChild @canvas
@width = @canvas.width = image.width
@height = @canvas.height = image.height
@context.drawImage image, 0, 0, @width, @height
clear: ->
@context.clearRect 0, 0, @width, @height
update: (imageData) ->
@context.putImageData imageData, 0, 0
getPixelCount: ->
@width * @height
getImageData: ->
@context.getImageData 0, 0, @width, @height
removeCanvas: ->
@canvas.parentNode.removeChild @canvas

View file

@ -0,0 +1,31 @@
.examples img {
width:100%;
}
.colors {
margin-top: 20px;
}
.colors > div {
display:inline-block;
text-align: center;
margin-bottom:10px;
}
.colors .color {
width:40px;
height:40px;
margin-left:25px;
margin-right:25px;
margin-bottom: 5px;
}
.footer {
padding-top:20px;
padding-bottom:20px;
color:#fff;
}
.footer a {
color: #E0F2F1;
}

View file

@ -0,0 +1,34 @@
document.addEventListener 'DOMContentLoaded', ->
examples = document.querySelectorAll '.examples > div'
for example in examples
img = example.querySelector('img')
img.setAttribute('src', img.getAttribute('data-src'))
img.addEventListener 'load', (e) ->
vibrant = new Vibrant this
panel = e.target.parentElement
panel = panel.parentElement while not panel.classList.contains('panel')
panel.style.backgroundColor = vibrant.VibrantSwatch.getHex()
panel.style.color = vibrant.VibrantSwatch.getTitleTextColor()
colors = document.createElement 'div'
colors.classList.add 'colors'
panel.querySelector('.panel-body').appendChild colors
profiles = ['VibrantSwatch', 'MutedSwatch', 'DarkVibrantSwatch', 'DarkMutedSwatch', 'LightVibrantSwatch', 'LightMutedSwatch']
for profileName in profiles
profile = vibrant[profileName]
if not profile then continue
colorHolder = document.createElement 'div'
color = document.createElement 'div'
color.classList.add 'color'
color.classList.add 'shadow-z-1'
color.style.backgroundColor = profile.getHex()
colorName = document.createElement 'span'
colorName.innerHTML = profileName.substring(0, profileName.length - 6)
colorHolder.appendChild color
colorHolder.appendChild colorName
colors.appendChild colorHolder

View file

@ -1155,6 +1155,7 @@ var AppInfo = {};
var paths = {
velocity: bowerPath + "/velocity/velocity.min",
vibrant: bowerPath + "/vibrant/dist/vibrant.min",
ironCardList: 'components/ironcardlist/ironcardlist',
scrollThreshold: 'components/scrollthreshold',
playlisteditor: 'components/playlisteditor/playlisteditor',