AddColor can not be emulated as native color information and drawn with each part as it is drawn. Just by looking at the "Color Tools" stack that came with HyperCard, it becomes obvious that a lot of trickery like opaque buttons is used to hide B/W parts, while not covering the color on the same layer.
AddColor drew its colors in the correct order, back-to-front, background layer, then card layer, into a separate "color overlay" buffer. Then, the color overlay was merged with the B/W card contents using the "or" pen mode, effectively producing a "darken only" pen mode effect and replacing all white parts with pixels from the color buffer, while leaving the black parts untouched.
The AddColor XCMD could be used to refresh the color buffer contents on card changes, display visual effects on card changes or other occasions, and to add/delete/hide/show color elements, which were essentially independent of the real HyperCard objects.
For each background/card there is a corresponding 'HCbg' resp. 'HCcd' resource, with the same ID as that object, containing one entry for each object on the card or background. The resource simply contains one object entry after the other, until the end of the resource, in big-endian byte order:
1 byte | Object type High bit is hidden flag |
n bytes | Object-specific data |
There are four kinds of objects, each of which has a different block layout. Here's the layouts of each one:
Button:
1 byte | Object type 0x01 High bit is hidden flag |
2 bytes | Button ID |
2 bytes | Bevel |
2 bytes | Red Value (0...65535) |
2 bytes | Green Value (0...65535) |
2 bytes | Blue Value (0...65535) |
1 byte | Object type 0x02 High bit is hidden flag |
2 bytes | Button ID |
2 bytes | Bevel |
2 bytes | Red Value (0...65535) |
2 bytes | Green Value (0...65535) |
2 bytes | Blue Value (0...65535) |
1 byte | Object type 0x03 High bit is hidden flag |
2 bytes | Top coordinate |
2 bytes | Left coordinate |
2 bytes | Bottom coordinate |
2 bytes | Right coordinate |
2 bytes | Bevel |
2 bytes | Red Value (0...65535) |
2 bytes | Green Value (0...65535) |
2 bytes | Blue Value (0...65535) |
1 byte | Object type 0x04 High bit is hidden flag |
2 bytes | Top coordinate |
2 bytes | Left coordinate |
2 bytes | Bottom coordinate |
2 bytes | Right coordinate |
1 byte | Boolean transparent |
1 byte | Length of image name |
n bytes | Image name |