commit 2fa4fb44148063c4cfd872183487d2b70c5d96e3 Author: Ryan McGrath Date: Mon Aug 10 21:58:13 2009 -0400 Initial commit, working version diff --git a/1600.jpg b/1600.jpg new file mode 100644 index 0000000..6a51514 Binary files /dev/null and b/1600.jpg differ diff --git a/css/example.css b/css/example.css new file mode 100644 index 0000000..925f180 --- /dev/null +++ b/css/example.css @@ -0,0 +1,105 @@ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, font, img, kbd, q, s, samp, +small, strike, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { +margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } +:focus { outline: 0; } +body { line-height: 1; } +ol, ul { list-style: none; } +table { border-collapse: separate; border-spacing: 0; } +caption, th, td { text-align: left; font-weight: normal; } +blockquote:before, blockquote:after, q:before, q:after { content: ""; } +blockquote, q { quotes: "" ""; } + +@font-face { font-family: "Axel"; src: url(/css/Axel-Regular.ttf) format("truetype"); } + +html { + background-color: #6d7985; + color: #fff; + font: normal 62.5%/1 helvetica, sans-serif; + padding: 0px; + text-align: center; +} + +body { + position: relative; + text-align: left; + width: 600px; + margin: 10px auto; + padding: 10px; +} + +h1 { + font: normal 1.8em/2.4em "Axel", helvetica, sans-serif; + color: #fff; +} + +#footer, #container_top, #container_bottom { + background-color: #404d59; + margin: 10px auto 5px; + text-align: left; + padding: 10px; + width: 580px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + float: left; +} + +#container_bottom { display: none; } + +#footer { text-align: center; font-size: 1.2em; line-height: 1.4em; } + +a, a:visited { color: #f4d496; text-decoration: none; } +a:hover { text-decoration: underline; } + +#lol_container { + float: left; + width: 100px; + height: 100px; +} + +#lol { + background-color: #111; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; +} + +#lol_hidden { visibility: hidden; top: 0; left: 0; z-index: -10; } + +#interface { + float: right; + width: 460px; + margin-top: 34px; +} + +#interface p { + font: normal 1.2em/1.5em helvetica, sans-serif; + padding: 4px 1px; +} + +#img_input { + border: 1px solid #c9c9c9; + padding: 4px; + margin: 0 5px 0 0; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + width: 370px; +} + +#img_submit { + border: 1px solid #55a2c9; + background-color: #498fb2; + color: #fff; + padding: 3px 5px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; +} + +#log_colors { padding-left: 4px; } + +.color_box { + float: left; + width: 26px; + height: 26px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + margin: 2px 6px 3px 0; +} diff --git a/fallout.jpg b/fallout.jpg new file mode 100644 index 0000000..4b78d1d Binary files /dev/null and b/fallout.jpg differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..b1ae256 --- /dev/null +++ b/index.html @@ -0,0 +1,54 @@ + + + + + Franz - client side color palettes from logos + + + + + + + +

Franz - client side color swatches

+ +
+
+ + +
+ +
+
+ + +
+

Try out: lol.png, testjubs.jpg, stars.jpg, 1600.jpg, fallout.jpg

+
+
+ +
+
+ +
+
+ + + + + diff --git a/js/franz.js b/js/franz.js new file mode 100644 index 0000000..c722f02 --- /dev/null +++ b/js/franz.js @@ -0,0 +1,44 @@ +var franz = { + canvas: {}, + ctx: {}, + img: {}, + final_colors: [], + + init: function(canvas_id) { + franz.canvas = document.getElementById(canvas_id); + franz.ctx = franz.canvas.getContext('2d'); + return false; + }, + + loadImg: function(img_src) { + franz.img = new Image(); + franz.img.onload = function() { + franz.ctx.drawImage(franz.img, 0, 0, 100, 100); + setTimeout(function() { franz.getColors(); }, 100); + } + franz.img.src = img_src; + return false; + }, + + getColors: function() { + var hidden_canvas = document.getElementById("lol_hidden"), + extra_ctx = hidden_canvas.getContext('2d'), + docString = ""; + + extra_ctx.drawImage(franz.img, 0, 0, 19, 19); + var imageData = extra_ctx.getImageData(1, 1, 18, 18).data, + arr = []; + + for(var i = 0; i < imageData.length; i = i + 4) { + arr[0] = imageData[i]; + arr[1] = imageData[i + 1]; + arr[2] = imageData[i + 2]; + // Ugly 4AM method, don't ask + docString += '
'; + } + + document.getElementById("log_colors").innerHTML = docString; + $("#container_bottom").fadeIn("slow"); + return false; + } +} diff --git a/lol.png b/lol.png new file mode 100644 index 0000000..633e394 Binary files /dev/null and b/lol.png differ diff --git a/stars.jpg b/stars.jpg new file mode 100644 index 0000000..700894b Binary files /dev/null and b/stars.jpg differ diff --git a/testjubs.jpg b/testjubs.jpg new file mode 100644 index 0000000..5fd5c9c Binary files /dev/null and b/testjubs.jpg differ