Happy New Year 2017

Sunday 1 January 2017, 6:03 pm   ////  

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.

1 Comment »

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

    Comment by libby norman — 2017-01-04 @ 8:45 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2017 Post Position | Barecity theme