How HyperCard got its color back…

By uliwitness

HyperCard 2.4 New Features stack

Many people have heard of HyperCard: An offline precursor to the modern web, the Mac equivalent to Visual Basic, the tool the first Wiki and Myst were made with. Sometimes it is also called the first widely-used implementation of Hyperlinks (though it didn’t really get easy-to-use text link support until the 2.x series, and even that was more complicated than the links we are used to today).

Many people have also heard that HyperCard never got proper color support. But wait ! Myst was a full-color game! It even played movies! One of these has to be wrong!

As always, it’s a matter of nuances. Of platforms. And of ingenious hacks.

Black and White

The Crow HyperCard stack

When HyperCard came out, Bill Atkinson intentionally chose a crisp, B/W bitmapped window size of 512×342 pixels. It was the best they had at the time, and it meant that everyone, even people with small Mac Plus/Classic screens, would be able to view it. Being able to trade stacks with your friends was an important part of the social experience of HyperCard.

Atkinson invented a clever lossless image compression scheme, known as “Wrath of Bill” or “WOBA” among HyperCard reverse-engineerers, that reduced these B/W pictures to a practical size through a variety of tricks, including run-length-encoding and XORing a row with previous rows, which meant that even a checkerboard pattern compressed into one line of dots XORed repeatedly with a black row.

In 1990, this format was re-engineered slightly so a card could be an arbitrary size, as long as its width was still a multiple of 16.

Native color support

HyperCard IIGS TuneMaker

In 1991 a separate team at Apple was tasked to port HyperCard 1.x back to Apple IIGS home computers. As they had a blank slate to start from, they integrated support for native color. You were able to choose from the Apple IIGS’s 16 color palette by specifying color numbers, and they also added a few features that would later make it back into the original, like radio button groups.

Macintosh HyperCard, then at 2.0, still had no color support. Worse, the syntax introduced for the Apple II and the color file format were not really suitable for Macs, as the IIGS had a very limited color set and pixels that were taller than wide.

Colorizing HyperCard

ColorizeHC's color mode selector

After HyperCard had made its way into the hands of Apple-subsidiary Claris, engineers Eric Carlson and Anup Murarka came up with an ingenious hack to bring color to HyperCard without having to change the file format or even touch the engine code:

HyperCard used double-buffered display. That is, whenever it had to redraw part of the window, it first painted all the individual parts onto each other in a hidden “buffer”, and then copied that buffer to the window on screen. This meant you never got the “stacking” effect seen in so many other drawing programs.

This last copying step was achieved using a system call named CopyBits. If you replaced this system call with your own routine from a HyperCard plugin, you could check whether the destination to be copied to was the current document’s window, and if it was, mix other drawings in.

Since HyperCard used black outlines and white, they used a “darken” drawing mode to draw their color on top of the B/W picture. Black would stay black, as it is the darkest color, while white areas would “show through” the color overlay. Of course this third merging step wasn’t very fast on the hardware of the time, but it worked fairly well.

Colorizing HyperCard startup screen

When it was decided not to release this hack due to concerns about the support load it would generate, the two engineers quickly replaced the Claris logo with a “BungDabba Productions” logo and got permission to release it as a free third-party extension.

AddColor and InColor

AddColor New Features Stack

For a while, Heizer Software, a large distributor of popular HyperCard plugins, created its own color overlay plugin named InColor with features like color transition effects (this is what Myst was made with). Eventually, HyperCard proper followed suit. First shipped as a pre-release for use with 2.2, the HyperCard Color Tools stack was included in 2.3.

The included AddColor XCMD used the same approach as ColorizeHC, but instead of having to script all the pictures and drawings you wanted on a card, it wrote the list of items and their colors into ‘HCcd’ and ‘HCbg’ resources with the same ID numbers as your cards and backgrounds, and provided InColor-style transition effects.

The stack also implemented an editor interface that provided a color and tools palette that allowed to select buttons and fields by simply clicking them and then a color, and even drew its own “marching ants” selection on top of the selected items, in a fashion not dissimilar to how the editors in other HyperCard clones like SuperCard worked, although a separate XFCN named “clicker” had to be used to intercept mouse clicks on the card and draw the marching ants.

AddColor 2.0 PICT paint editor

You were able to set a “depth” for the edges of an object, and apart from buttons and fields could also add colored rectangles, PICT files or resources to a card’s color overlay. With AddColor 2.0 (included with HyperCard 2.4) you even got a PICT editor window with color paint tools.

Animation in HyperCard

HyperCard’s animation support had usually restricted itself to changing 32×32 pixel icons (and later arbitrarily-sized PICTs using the “icon ID -1 plus button name” trick), or flipping through cards. Given how slow the color overlay performed on most Macs of the time, these weren’t really an option for fluid animation in color.

So HyperCard 2.2 bundled ADDmotion II. Not unlike the Color Tools, this product from MotionWorks created its own editor on top of HyperCard, providing you with a Macromind-Director-style timeline interface and pixel graphic editor. The animations generated were completely separate from HyperCard. They were saved to the stack and then you could use an XCMD to play one inside the card window, covering the card, and then returning you to HyperCard again.

So No Released HyperCard for MacOS ever had Color?

HyperCard New Features Stack Button Tasks Page

Nope. Basically, every HyperCard version from 2.1 on added a few new commands here and there, but it was the same HyperCard 2.x.

An exception could be made for HyperCard 2.2, which added a few new button types (popup buttons, more native-looking “standard” and “default” buttons) and other visible features to the core engine, and support for other OSA scripting languages like AppleScript instead of HyperTalk. But color? Nope.

Screen shots courtesy of @HyperCard, used with permission.

2 Comments Leave a comment

  1. Steve Israelson 2016-11-21 at 03:51 Reply

    Very interesting article!

    I was the engineer that created the color xcmd and worked on ADDmotion.
    Those were fun times back then!

    • Didn’t you also have a 3D engine some time later? Marathon-like, portal-based … ? Vaguely remember your name from something like that :-)

Share your thoughts