Monthly Archives: November 2005

Any-Colour Fade Technique

I’m sure many of you will have heard of the yellow fade technique, pioneered by 37 signals and popularised by its use in Basecamp. The problem with that script, however, is that the colours, including all the steps in between, are hard coded which makes it fairly complex to work with if you’re not just fading one colour.

For a project I’m working on at the moment, the client wanted various colours to fade appropriately, and I needed a script that was not only generic in the colours it supported, but incredibly easy to reuse. I also figured, why don’t I just make a general colour object to handle all your scripting-colour needs.

So, I give you the Color() script. Although I took inspiration from Eric Meyer’s Color Blender, I did completely rewrite the entire script for my needs. This is an object-oriented script who’s constructor accepts various parameters in order to specify the colour and it even has support for an alpha channel. You can either pass it 3 integer parameters, each representing the RGB colour component and an optional 4th parameter representing the alpha channel. Additionally, it will also accept a string with any valid CSS 2.1 Color Value or keyword, plus CSS3’s RGBA syntax. (HSL and HSLA are not yet supported).

The blend function is where it really shines. You pass it the colour you wish to blend with and the number of steps it should take, and it returns a pallet of colours for all the steps. I made a colour fading demo just to show off how powerful and easy to use the script is. Enter any supported colour value and watch the background colour fade from the current colour to the new colour. You can also customise the number of steps and the interval between them. I hope you find this script useful, feel free to use it wherever or however you like.

W3C Web Apps

It’s official, the W3C have finally launched their efforts to standardise APIs and formats for web application development with the announcement of two new Working Groups: The Web APIs Working Group and the Web Application Formats Working Group.

The Web APIs Working Group will work on standardising and improving upon, among other things, XmlHttpRequest() and the window object; and reviving the stagnant DOM Level 3 work. They will also produce guidelines for web applications and other educational material. As discussed in the Web APIs WG Charter, This will involve collaboration with other external groups including, among others, the WHATWG and the WaSP DOM Scripting Task Force.

The Web Application Formats Working Group will develop languages for client side web applications. In particular, they will work on standardising existing formats such as Mozilla’s XUL, Microsoft’s XAML, Macromedia’s MXML or Laszlo Systems’ LZX. They will also work on the XBL 2 specification and produce guidelines and other educational material as required.

If you would like to be involved, or just keep up with their work, there is of course a public mailing for each of them: public-webapi and public-apiformats. As mentioned on their respective WG home pages, they’re also intending to be setting up blogs to discuss their work.