Last active
August 29, 2015 14:19
-
-
Save knugie/fe3466ed32427a31fc9d to your computer and use it in GitHub Desktop.
Check out http://kuku-kube.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint browser: true, indent: 2 */ | |
(function () { | |
'use strict'; | |
var rgb, style, idx = 0, store = {}, tiles = document.getElementById('box').childNodes; | |
for (idx; idx < tiles.length; idx += 1) { | |
rgb = tiles[idx].style.backgroundColor.split("(")[1].split(")")[0].split(","); | |
store[Math.sqrt(Math.pow(rgb[0], 2), Math.pow(rgb[2], 2), Math.pow(rgb[2], 2))] = tiles[idx]; | |
} | |
style = Object.keys(store).map(function (key) { return [key, store[key]]; }). | |
sort(function (a, b) { return parseInt(a[0], 10) < parseInt(b[0], 10) ? 1 : -1; })[0][1].style; | |
style.border = '2px solid white'; | |
style.outline = '2px solid black'; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
minified for KuKu Kube Bookmarklet: