Happy New Year 2017

My New Year’s poem for 2017 is Colors, a 1KB Web page, online at http://nickm.com/poems/colors.html and here it is, too:

<!DOCTYPE html>
<html style="overflow:hidden">
<head><meta charset=utf-8>
<!-- Copyright (c) 2016 Nick Montfort <nickm@nickm.com>   2016-12-31, 1KB

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.

Click pauses, Add ?00f000 or similar to URL for the specified color.-->
<script type=text/javascript>
var c = 0, i;
function up() {
 if (c > 16581375) { c = 0; }
 document.body.style.background = "#"+("00000"+c.toString(16)).slice(-6);
 c += 1;
}
function pause(e) {
 if (i) { clearInterval(i); i = 0; } else { go(); }
}
function init() {
 var s = window.location.search;
 if (s.slice(0, 1) === '?') { c = parseInt(unescape(s.slice(1)), 16); }
 go();
}
function go() { i = window.setInterval(up, 5); };
</script>
<title>Colors</title></head>
<body onload=init() onmousedown=pause(event)>
<div style="width:100vw; height:100vh"></div>
</body>
</html>

As the code says, you can add an argument in the URL to start with a particular color, such as medium gray:

http://nickm.com/poems/colors.html?808080

Click to stop on a particular color that you especially like. Click again to continue moving through the colors. If you let it run, you’ll see all 16581375 colors in just over 23 hours.

Happy new year.

One Reply to “Happy New Year 2017”

  1. i must thank you for this additional gift of procrastination as i write my dissertation (man i feel poetic)

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

This site uses Akismet to reduce spam. Learn how your comment data is processed.