29
.gitignore
vendored
@ -35,3 +35,32 @@
|
|||||||
.Trashes
|
.Trashes
|
||||||
ehthumbs.db
|
ehthumbs.db
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directory
|
||||||
|
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
|
||||||
|
node_modules
|
3
README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Simple Icons
|
||||||
|
|
||||||
|
SVG icons for popular brands. https://simpleicons.org
|
112
build.js
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
// Get JSON from source file
|
||||||
|
var source = require('./simple-icons.json');
|
||||||
|
|
||||||
|
// Loop through icons
|
||||||
|
for (var i = 0; i < source.icons.length; i++) {
|
||||||
|
|
||||||
|
var hex = source.icons[i].hex;
|
||||||
|
|
||||||
|
// Add red, green and blue values to the JSON object
|
||||||
|
var red = parseInt(hex.substr(0,2), 16) / 255;
|
||||||
|
var green = parseInt(hex.substr(2,2), 16) / 255;
|
||||||
|
var blue = parseInt(hex.substr(4,2), 16) / 255;
|
||||||
|
|
||||||
|
// Add hue to the JSON object
|
||||||
|
var max = Math.max(red, green, blue);
|
||||||
|
var min = Math.min(red, green, blue);
|
||||||
|
var delta = max - min;
|
||||||
|
source.icons[i].luminance = 100 * (max + min) / 2;
|
||||||
|
if (delta === 0) {
|
||||||
|
var hue = 0;
|
||||||
|
source.icons[i].saturation = 0;
|
||||||
|
} else {
|
||||||
|
if (source.icons[i].luminance < 50) {
|
||||||
|
source.icons[i].saturation = 100 * (max - min) / (max + min);
|
||||||
|
} else {
|
||||||
|
source.icons[i].saturation = 100 * (max - min) / (2 - max - min);
|
||||||
|
}
|
||||||
|
if (max === red) {
|
||||||
|
var hue = ((green - blue) / delta) * 60;
|
||||||
|
if (hue < 0) {
|
||||||
|
hue += 360;
|
||||||
|
}
|
||||||
|
} else if (max === green) {
|
||||||
|
var hue = (((blue - red) / delta) + 2) * 60;
|
||||||
|
} else {
|
||||||
|
var hue = (((red - green) / delta) + 4) * 60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
source.icons[i].hue = hue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort icons by hue
|
||||||
|
|
||||||
|
// Ensures blue icons appear first in the last, purple ones last
|
||||||
|
for (var i = 0; i < source.icons.length; i++) {
|
||||||
|
source.icons[i].hue += 100;
|
||||||
|
source.icons[i].hue = source.icons[i].hue % 360;
|
||||||
|
}
|
||||||
|
source.icons.sort(function(a, b) {
|
||||||
|
return parseFloat(b.hue) - parseFloat(a.hue);
|
||||||
|
});
|
||||||
|
var tmp = [];
|
||||||
|
for (var i = 0; i < source.icons.length; i++) {
|
||||||
|
if (source.icons[i].luminance < 10) {
|
||||||
|
tmp.push(source.icons[i]);
|
||||||
|
source.icons.splice(i,1);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i = 0; i < source.icons.length; i++) {
|
||||||
|
if (source.icons[i].saturation < 5) {
|
||||||
|
tmp.push(source.icons[i]);
|
||||||
|
source.icons.splice(i,1);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tmp.sort(function(a, b) {
|
||||||
|
return parseFloat(b.luminance) - parseFloat(a.luminance);
|
||||||
|
});
|
||||||
|
for (var i = 0; i < tmp.length; i++) {
|
||||||
|
source.icons.push(tmp[i]);
|
||||||
|
}
|
||||||
|
console.log(tmp);
|
||||||
|
|
||||||
|
// Read header and footer content into variables
|
||||||
|
var fs = require('fs');
|
||||||
|
function readFile(path, callback) {
|
||||||
|
try {
|
||||||
|
var filename = require.resolve(path);
|
||||||
|
fs.readFile(filename, 'utf8', callback);
|
||||||
|
} catch (e) {
|
||||||
|
callback(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var fs = require('fs');
|
||||||
|
var header = fs.readFileSync('./src/header.html', 'utf8');
|
||||||
|
var footer = fs.readFileSync('./src/footer.html', 'utf8');
|
||||||
|
|
||||||
|
// Build content
|
||||||
|
var main = "<p class=\"hero\">" + source.icons.length + " SVG icons for popular brands <a href=\"https://github.com/danleech/simple-icons\">Download them from GitHub</a></p>\n<ul class=\"tiles\">";
|
||||||
|
|
||||||
|
for (var i = 0; i < source.icons.length; i++) {
|
||||||
|
var fileName = source.icons[i].title.toLowerCase();
|
||||||
|
fileName = fileName.replace(' ', '');
|
||||||
|
fileName = fileName.replace('!', '');
|
||||||
|
fileName = fileName.replace('.', '');
|
||||||
|
fileName = fileName.replace('+', 'plus');
|
||||||
|
filePath = "./icons/" + fileName + ".svg";
|
||||||
|
console.log(source.icons[i].title + ", sat = " + source.icons[i].saturation);
|
||||||
|
var fs = require('fs');
|
||||||
|
var svg = fs.readFileSync(filePath, 'utf8');
|
||||||
|
main += "\t\t\t<li style=\"background-color:#" + source.icons[i].hex + "\"><a href=\"https://github.com/danleech/simple-icons/tree/master/icons/" + fileName + ".svg\">" + svg + source.icons[i].title + "<br><span class=\"hex\">#" + source.icons[i].hex + "</span></a></li>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put all content together and export to index.html
|
||||||
|
var htmlOutput = header + main + footer;
|
||||||
|
fs.writeFile("./index.html", htmlOutput, function(err) {
|
||||||
|
if(err) {
|
||||||
|
return console.log(err);
|
||||||
|
}
|
||||||
|
console.log("The file was saved!");
|
||||||
|
});
|
1
icons/500px.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M14.008 13.3c-.113-.114-.21-.18-.294-.204-.085-.025-.16-.007-.22.053l-.056.054c-.58.58-1.26 1.038-2.012 1.357-.78.33-1.61.498-2.464.498-.855 0-1.684-.167-2.465-.497-.753-.318-1.43-.774-2.012-1.356-.606-.606-1.062-1.283-1.357-2.012-.287-.712-.38-1.247-.41-1.422l-.008-.04c-.04-.206-.23-.22-.504-.18-.114.02-.46.072-.428.32v.007c.093.577.255 1.143.483 1.682.367.865.89 1.642 1.56 2.31.667.668 1.445 1.192 2.31 1.558.897.38 1.85.572 2.832.572.98 0 1.933-.192 2.83-.572.866-.366 1.644-.89 2.312-1.56 0 0 .038-.036.058-.058.073-.08.137-.22-.154-.51M8.952 1.713c-.938 0-1.936.19-2.67.507-.077.03-.124.094-.134.183-.01.083.013.193.07.337.044.116.165.424.4.335.75-.286 1.58-.444 2.334-.444.857 0 1.688.17 2.47.5.62.262 1.207.642 1.844 1.194.046.04.096.06.146.06.125 0 .244-.12.346-.236.17-.19.287-.35.12-.508-.61-.576-1.276-1.007-2.1-1.355-.895-.38-1.846-.57-2.826-.57m-1.278 7.93c0 .107.098.2.156.256l.018.018c.1.098.194.148.28.148.074 0 .118-.035.134-.05.044-.04.54-.542.586-.59l.552.55c.052.06.107.087.172.09.088 0 .184-.053.286-.157.238-.244.12-.375.06-.44l-.56-.558.585-.588c.128-.14.015-.286-.098-.4-.163-.162-.32-.205-.423-.11l-.58.58-.587-.587c-.03-.03-.07-.045-.113-.045-.078 0-.17.052-.275.157-.18.18-.22.304-.125.403l.587.586-.585.583c-.048.048-.072.1-.07.153m-3.723.867c.004.01.087.24.135.352.263.624.64 1.184 1.122 1.665.48.48 1.04.858 1.663 1.122.646.273 1.332.412 2.04.412.706 0 1.392-.14 2.038-.412.625-.264 1.185-.642 1.665-1.122.48-.48.86-1.04 1.123-1.665.273-.646.41-1.332.41-2.04 0-.706-.137-1.392-.41-2.037-.264-.624-.642-1.184-1.123-1.665-.48-.48-1.04-.858-1.664-1.122-.645-.272-1.33-.41-2.038-.41-.715 0-1.43.14-2.067.41-.51.216-1.37.77-1.875 1.29l-.003.004V.984h7.24c.264-.003.264-.37.264-.492 0-.12 0-.49-.263-.492h-7.83c-.212 0-.344.177-.344.342v6.066c0 .196.244.337.47.386.443.094.545-.047.653-.197l.015-.02c.166-.245.683-.765.688-.77C6.665 5 7.743 4.554 8.895 4.554c1.146 0 2.222.445 3.03 1.25.808.81 1.254 1.883 1.254 3.02 0 1.143-.445 2.216-1.25 3.02-.795.796-1.906 1.252-3.047 1.252-.773 0-1.52-.206-2.16-.596l.004-3.688c0-.49.214-1.026.57-1.43.41-.462.973-.716 1.587-.716.595 0 1.15.226 1.565.636.41.407.636.95.636 1.527 0 1.232-.97 2.198-2.207 2.198-.24 0-.673-.106-.69-.11-.25-.075-.357.272-.392.387-.135.44.068.527.11.54.398.123.66.147 1 .147 1.748 0 3.17-1.422 3.17-3.17 0-1.734-1.42-3.144-3.167-3.144-.854 0-1.657.327-2.26.92-.575.565-.905 1.32-.905 2.067v.02c-.003.092-.004 2.304-.005 3.03l-.003-.004c-.33-.363-.653-.92-.868-1.488-.086-.223-.276-.183-.536-.103-.114.034-.46.14-.383.39l.002.003z" fill="#fff" fill-rule="nonzero"/></svg>
|
After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 299 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 576 B |
Before Width: | Height: | Size: 578 B |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 748 B |
Before Width: | Height: | Size: 737 B |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 400 B |
Before Width: | Height: | Size: 396 B |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 539 B |
Before Width: | Height: | Size: 542 B |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 662 B |
Before Width: | Height: | Size: 660 B |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 285 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 668 B |
Before Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 645 B |
Before Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 23 KiB |