Adding Colour to HyperCard

This is the bit some folk don't like about HyperCard.
Here is how to add some colour.

You may notice I am changing from the British way of spelling colour to color; thats because all the HyperCard external code expect you to be American!

HyperCard does not have built in Color!
But Apple have added on an XCMD(external command) that can do the job, however, the external just adds a colour layer to the window.
For reason best known to more technical people tham myself this is not a great thing. Some of the problems include: speed for drawing color, although this is not a problem on G3s; the fact that the color is not really attached to the object, for instance if you move a button, you need to redraw the color for the color layer to move to the buttons new position, this can seem a bit clunky.

The lack of color is one of the main reasons Hypercard has fallen from favour.

In it's favour HyperCard can display PICT files in full colour in external windows and using the latest version can display any graphic format QuickTime supports, including Quicktime movies with a great deal of control. I belive that Apple's quickTime team use HyperCard for testing a lot of QuickTime features.

On this page I am just going to give you a quick guide to coloring the Text Muncher stack we made earlier:

First Choose Open Coloring Tools from the Color menu (If you do not see the Color menu you need to install the color tools from the color tools stack that comes with HyperCard 2.2 or later)
you will see this dialog; click OK.

a dialog
The AddColor Tools palette opens, you now cannot do normal Hypercard things until you close it.
Choose a nice color for your window and double click the RECT button.

color tools
Resize the colored rect to fit the card.

Click on the field tool on the palette, then click on the field, lastly click on a color for the field.

Click on the button tool on the palette, then click on a button, lastly click on a color for the button.

You can then double click on the button to give it a bevel.

color tools
What's been going on.
When you open Color Tools the first time in a stack and click OK in the dialog, it installs an XCMD (external command) into to your stack and adds or changes some handlers in your stack script:
on openCard
  Send colorMe to this card
  pass openCard
end openCard

on closeCard
  lock screen
  pass closeCard
end closeCard

on colorMe
  AddColor colorCard,stamp,0
end colorMe

on openStack
  AddColor install
  pass openStack
end openStack

on closeStack
  AddColor remove
  pass closeStack
end closeStack
  These handler just tell HyperCard to redraw the color you have added to a card when it opens (with the colorMe handler) and to install/remove AddColor when the stack opens/closes.

When colorMe is called from openCard it tells the AddColor XCMD to:

AddColor colorCard,stamp,0 This command does the following:

AddColor Directs the following parameters to the AddColor XCMD .

colorCard Tell the XCMD to redraw the card, refering to a database it has installed in the stacks resource fork.

stamp The visual effect to use; in this case none.

0 The speed of the visual effect, in this case as fast as possible.

Important, this is a very sketchy quick start to using AddColor. There are many other ways of using color with the AddColor XCMD, check the HyperCard documentation and my links page for more details.

There are other methods for adding color using other XCMDs, one package is the Colorizing HC XCMD and the HyperCard developer Uli Kusterer has recently (January 2000) released a new set of XCMDs for coloring Hypercard, you can download them from his Witnesses of TeachText site look in the programming section.

Top of this page
Back to the How To index
Back to the LittleFish Card Page