Martin Ström
my-domain.se

Colhour WordPress plugin

Colhour Plugin This is a plugin for WordPress. The Plugin makes it easy to have elements on your site in colors generated by the Colhour system. Basically it will let you input CSS rules from a option page in the WordPress Admin, and when the site is viewed later it will have the colors replaced by an ever updating Colhour-color.

There are a couple of input fields on the options page; one for each “length” of the spectrum (for it to start over again). I.e., if you want a div element with the id “header” to get its background colorized from Colhour and its Colhour cycle starting over every day (after 24 hours), you just enter the CSS rules in the “day” input field. The actual color-value should be replaced with `%colhour%´ so the plugin can insert the current color in its place. 

colhour-plugin2.png

I suggest not having any other CSS rules in the Colhour admin than the ones dealing with the colors you want replaced. I.e., strip out the fonts, border sizes etc and keep all that in your .css file where they belong (and can be cached).

Bad:

#myDiv {
    font: 1.1em Courier; 
    padding: 2em;
    background: #DDD url(my-background.png) no-repeat top left;
    border: 2px dotted %colhour%;
}

Good: 

#myDiv {border-color: %colhour%;}

Download here, put it in your wp-themes/plugins/colhour.php (note the .php extension) folder and activate it as usual in WordPress admin » Plugins. The options can be found under Options » Colhour.

Update May 4, 2006 I’ve updated the plugin with some minor tweaks and UI enhancement. Also, this site is now using the plugin to style the links.

Colhour IRL

Another Colhour project! I wanted to try to take the Colhour system a step out from the digital to the “real” by making a regular wall clock using the Colhour system. This was mostly an attempt to see if the concept could work outside the computer and if I could find the parts needed.

I wanted to find a mechanical clockwork that had date, year and month (or an easy way to hack it) as well, since the original system isn’t just using hour, minutes and seconds, but also dates. Sadly, I couldn’t find any clockwork like this (didn’t really expect it actually) so I bought a regular one and built the clock around my limitations.

My first solution was to set the date, year and month by hand since it isn’t so hard to adjust it everyday. But I changed it and removed the date parts and used just the parts the clock could control automatically. It’s currently made of just paper glued to the clock’s hands to rotate. The result works, but I realized the hour is made for a 24 h clock but the clockwork, of course, is using 12 h. As an experiement this works for now, but I want to find a solution to make the dates work as well. One possibility could be to build my own clockwork and control it from the computer. Or one could put a 48 times bigger gear driven by the hour hand to make that one drive the date hands.

First version with manually controlled date hands

Second version, without dates


Updated Colhour website

Colhour website

Colhour is my and Peters system to visualize time using colors. We wanted to extend the previous web site a bit by adding more information about the system and link to projects that were using the system. Also, the former site didn’t set the “Right now” text in the current times color but black only. I decided to rewrite the flash content from scratch, mainly because I wanted to do it in ActionScript 2, and then use the new BitmapData class available in Flash 8. It was my first “real” AS2 project but I’ve done some Java before and a lot of reading about AS2 so there weren’t any problems to make it work. I used the BitmapData#getPixel to get the actual color from the flash movie from specified positions, instead of hard coding all available colors into an array and then update the text field with correct color from the current time. After spending too much time with some wierd coordinate error I got (and make a ASCII-generator from everything), I finally worked it out. After the first update, the update method won’t trigger if nothing has happend to the hand (year, month etc). Since most visitors of the site won’t wait so long that they’ll see any update in year, month, date or even hour, it was unnecessary waste of CPU to update all hands all the time.

Colhour


Colhour as iChat picture 2.0

This is the second version of the Colhour as iChat picture I posted the other day. The biggest improvment is that it will show both the hours and the minutes.

There’re two versions of the script. The first one uses a Ruby script together with RMagick to create every image on the fly with the current time. But since it requires some installation of Ruby gems and other libraries, I decided to make a version with all 1440 images pregenerated (created with a small Ruby script of course) so you wont need to install the other libraries. The AppleScript still uses some Ruby, but it’s included in OS X, and should (at least) work on a basic OS X 10.4 Tiger installation. Let me know otherwise.

Instructions on how to set up a cron job to run the script every minute is in the previous post. Both the on-the-fly generated version (update-gen.scpt) and the pregenerated version (update-pregen.scpt) are included in the zip file.


iChat picture with Colhour

This is a small AppleScript to update your iChat picture from the Colhour system that I have created with Peter. From the beginning I wanted to update it every second, but since it used 60% – 80% CPU, I decided to go with an update rate of once a minute instead. So you’ll only be able to se the current minute from the iChat picture.

To install: Download and extract somewhere on your hard drive. Edit your crontab file manually or with an app like Cronnix to run the script every minute. It should look something like this:

*/1 *   *   *   *   YourUserName    osascript ~/path/to/update.scpt

I suppose I should do this in the “correct OS X Tiger” way by using launchd instead, but that’s for next time. As well as update it to show the the full date in different squares (without seconds due to CPU usage) like the one on harald.net

Source included.

Version 0.2

Added a check in the script to see if iChat is running or not, so it wouldn’t launch iChat every minute.


CSS is in progress