Cross-Platform Palettes

Release history

9/30/05: removed broken Macromedia tech-note link

12/31/97: extensive updates

11/19/97: cleaned up formatting, installed on web page

12/30/96: posted to Direct-L mailing list


I wrote this document up for posting in the Direct-L Macromedia Director developers' mailing list. I'd been doing research on custom 8-bit palettes for Director that work on both the Mac and Windows, and I wanted to get comments on what I've discovered and deduced. I didn't get any substantive feedback, but I still think the document is useful, and so am posting it here (after many updates).

I had to do some extrapolation and guessing at times; please let me know if I've missed/misstated something, or if there are some details that could be stated better.


As a starting point, the following is from the Director 5.0 for Windows ReadMe file:

"**Restricted colors for Windows**

"When you use a palette that does not have the same colors as the Windows system palette in the first and last eight positions, Director switches to a fully black-and-white interface. Unlike Director 4, any palette with the required colors in the required positions (not just System-Win) will allow the Windows and Director interface to stay in color.

"In palettes that have the required Windows system colors, Director also reserves four additional palette entries (two at each end) to include the current colors used by the Windows 95 custom desktop color scheme. This automatic palette adjustment occurs only on palettes that already have the 16 Windows colors in them; other palettes are not altered. These four colors are automatically reserved both on Windows and on the Macintosh, to allow creation of artwork on the Macintosh that can be played back under Windows 95 with custom desktop colors intact."

And, from Macromedia technical note 3174 (no longer available):

"Director for Windows uses palette animation for fast palette effects such as palette switches, fades and color cycling. The Windows Palette Manager only allows palette animation if an application reserves the system palette entries it uses for palette animation. However, the Windows Palette Manager will refuse to share these "reserved" colors with background applications. Hence other color-intensive applications switch to black and white since they are the only two colors positions that cannot be reserved. To counter palette contention problems, authors can give up speedy palette effects and keep Director from reserving any palette entries. Authors may use the setting "Animation=0" in the "[Palette]" section in the DIRECTOR.INI file for Director or the Projector."

Palette Test Movie

I've created a test Director 6.0 movie that tries out various palette combinations. It allows you to switch between four color palettes, two with the Windows 20 colors preserved and two with only black and white preserved. You can execute the switch with or without a fade. In addition, you can show a system alert, or invoke the Lingo "pause" command immediately followed by "continue". You can run it on the Mac or the PC, but it's really most useful when showing Win95 wierdnesses.

(To see a picture of the movie, click here. To download the movie as a Windows ZIP archive, click here. To download the movie as a Macintosh SIT file, click here. You'll need Director 6 to try either out.)

I've played with this movie quite a bit under Windows 95, both with [Palette]Animation=1 and [Palette]Animation=0. I discovered a number of things:

  • If Animation=1, and you show an alert box, then all subsequent palette transitions will be broken. Even worse, once an alert is shown the next palette transition may partially occur, leaving the actual palette set to be a mix of two palettes.

    Once transitions are broken, clicking the "pause/continue" button will update the screen to use the correct palette and allow subsequent palette transitions to work.

    If Animation=0 then showing an alert doesn't break palette transitions.

  • If you show a palette without Windows' 20 colors, and then click "Show System Alert", then the alert's colors will be messed up. If the palette has Windows's 20 colors in it, then the alert will look fine.

  • If you show a palette without Windows' 20 colors, then any visible background application will have its colors messed up.

  • If you switch a background application to the front then that application's colors will look fine, regardless of the palette or Animation setting. However, sometimes Director will act as if it has no custom colors (every color in the palette image will change to the closest of Windows' 20 standard colors). One way to see this is to bring up the Display Properties control panel, switch to the Appearance sub-panel, and select the "Rose" scheme (you don't have to "Apply" it). Then, switch to the Director movie, and then back to the Display Properties panel, watching the palette image. You'll see the smooth gradient in the palette change to just a few colors, chosen from the Windows' standard 20.

    One strange note: if you bring Director to the front, then a third application (e.g. Windows Explorer) to the front, and THEN the Display Properties to the front, you won't see the palette problems. Somehow showing the third application cleans things up and prevents Display Properties from being greedy. I think.

  • Changing the Animation setting doesn't seem to affect the palette transition speed at all. It may be that the transition I use (a fade from one palette to another) isn't very sensitive to the size of the fade steps. Some sort of fast color cycling should show a difference (with Animation=1 then the cycling should be faster than with Animation=0) but I haven't tried it.

  • The movie's colors almost always flash briefly when another application is brought to the front, or the movie is returned to the front.

  • If the palette contains the Windows' 20 colors, and the user has chosen a special desktop color scheme, then colors 8, 9, 246 and 247 may be changed even if Director is the front application.

Other Information

When displaying 8-bit images, the Mac "likes" to have color 0 be white and color 255 to be black. "Likes" means that for the most part the OS can handle palettes where this isn't true, but some application software requires it. Director, in particular, won't let you edit colors 0 and 255 to be anything but white/black, and in fact when you try to import an image where this isn't true Director will require you to remap it to another, conforming palette. So, for our purposes, 0 is white and 255 is black.

All other color positions may be played with at will; your projects will have the correct colors on the Mac. If the colors the system wants for its own use aren't available then it will default to a black-and-white appearance; the system won't mess with Director's colors. One note: if "Animate in Background" is turned on and you bring another application to the front, the second application's colors may be messed up by Director insisting on its set of colors.

Windows "likes" to have color 0 be black and color 255 to be white (I believe it actually demands it). It also considers the additional 18 colors from 1 to 9 and from 246 to 254 to be fair game for system interface use; by default the low number colors are dark pastels and the high number colors are bright primaries.

If you look at the "System - Win" palette in Director (Mac or Win), you'll find that the opposite of what I said is true: the low 10 colors are bright, with number 0 being white, and the high 10 colors are dim, with number 255 being black. Plus, colors 8, 9, 246 and 247 are marked as "reserved," and so aren't used when images are mapped to that palette. The actual colors are (in decimal RGB):

Index	Red	Green	Blue
0 255 255 255
1 0 255 255
2 255 0 255
3 0 0 255
4 255 255 0
5 0 255 0
6 255 0 0
7 128 128 128
8 160 160 164 (RESERVED)
9 255 251 240 (RESERVED)
... 236 other colors ...
246     166     202     240  (RESERVED)
247 192 220 192 (RESERVED)
248 192 192 192
249 0 128 128
250 128 0 128
251 0 0 128
252 128 128 0
253 0 128 0
254 128 0 0
255 0 0 0

(To see the "System - Win" palette from Director, click here.)

The same set of colors can be found in DeBabelizer 1.6.5 for the Mac in the "Windows Default 256" palette, except that the order is reversed, the "236 other colors" are all different, and all the "128"s in Director's colors 249 through 254 become "191"s in DeBabelizer's colors 1 through 6. I've heard that some of the static interface colors are darker in Win95 than in Win3.1, so perhaps DeBabelizer's color palette is based on Win3.1's palette.

(To see the "Windows Default 256" palette from DeBabelizer, click here.)

The reason for Director for Windows having the opposite color order from Windows itself is that, before displaying an image, DFW reverses both the color order in the requested palette and the color order in displayed images. In other words, the color with index X in a custom palette is actually written into the display palette at index (255 - X), and each pixel in each displayed image is subtracted from 255 before displaying (sounds complex, but I'm sure it takes few CPU cycles). Also, when importing images, PC format images (such as .BMP) have their palettes and pixels reversed before being added to the cast, preparing them to be reversed again for display. All this tap dancing means that a single set of images and palettes (with color 0 white and color 255 black) can work on both platforms.

Note that all the colors in this list "make sense" (are all combinations of 0 and one of 128, 192 or 255) except colors 8, 9, 246 and 247, which are the "reserved" colors in Director's palette (see the Director 5.0 ReadMe quotation above). If the current palette has the Windows' 20 colors, and Windows user chooses a different desktop color "scheme", then Windows may change these four color slots in order to show the scheme. Because of this, these four color slots are hazardous (using them on a machine with custom appearance colors would have bad results). I don't think the other 16 colors are liable to being changed.

You can actually play with all 254 colors in Windows (excepting black and white) as long as you never have any system component (e.g. dialog, alert, or QuickTime controller) visible, and you don't mind any visible background applications looking bad. If you've changed the reserved 20 colors and a system component appears then the component will look bad.



So, what does all this mean?

  • If you are sure your images are the only thing that will be displayed, then make your own custom palette using all 254 colors (if using a separate graphics program on the PC then leave 0 as black and 255 as black; otherwise leave 0 as white and 255 as black). Remember, though, that if anything like an alert is displayed then the alert's colors may be messed up. Caveat color.

  • The rest of us should take the "System - Win" palette from Director 5 (if you're developing on the PC outside of Director, reverse the order of the palette's colors). Create a 236-color superpallette from your source material, and graft the 236 colors into the middle of the "System - Win" palette (leaving the first 10 and last 10 as is). Mark "some" of the colors as reserved, so that none of your images uses them. (What is "some"? At least colors 8, 9, 246 and 247, and possibly colors 1-9 and 246-254, assuming Windows leaves white and black alone. Does anyone know which is right?) Now, convert all of your source material to this carefully honed palette, import into Director, and enjoy.

  • If you switch between palettes, and you show any system component (e.g. dialog, alert, or QuickTime controller) then you must either have Animation set to 0, or run "pause" and "continue" once the component is hidden.


So, the remaining questions are:

  • How does one correct for Win3.1's standard colors being different from Win95's colors? My guess: create a Win95-compliant palette, and reserve all of the Windows colors so that when Win3.1 changes one of those colors to its own color, our images don't change. Suggestions?

  • Did I miss anything?

If you have any info on these questions, or comments on the rest of the document, please let me know.



  • TechNote 3174, on Director palettes: (no longer available)

    Copyright © 2012 Daniel Griscom Site design  
Home Page Home Page Home Page