One of the striking aspect of Mac OS X 10.7 Lion is the extent to which it borrows from iOS. One amusing aspect of this mobile phone influence, is that the system now supports Emoji characters, which have been standardised within Unicode recently. While Emoji are technically characters, they are small icons, and are rendered both in iOS and in Mac OS X Lion as colour bitmaps. Having a font that is both a bitmap and colour is something I had not seen since the Amiga.
Beside cute animals, the Emoji range also contains some semi-useful icons, including ones that represent clocks faces for the twelve hours (between
String.fromCharCode(0x1F550) on Safari, you won’t get an error, just a bogus character in the private area (
Here is the resulting code (I factored out the surrogate calculation, mostly to avoid escaping problems with WordPress). If you use web-browser that supports emoji, you should see the actual code in action in the top-right corner of this page, if emoji are not supported, you will probably see an empty square.
var date = new Date(); var hour = (date.getHours() + Math.round(date.getMinutes() / 60) + 11) % 12; var emo = 0x1F550 + hour; var h = high_surrogate(emo); var l = low_surrogate(emo); clock = String.fromCharCode(h) + String.fromCharCode(l); document.getElementById("emoclock").textContent = clock;