This tutorial is written with Photoshop in mind, but it can easiliy be adapted to other paint programs.

Introduction: A little background

A image file is a series of dots called pixels.

In a RGB file each dot has entries for which value of red green and blue will be used at each location. The amount of available colors in an image depends on the range of values allowed for each seperate R G and B value. Most common is 8 bits each. Each bit is +/- so this gives you 2^8 or 256 "shades" for each seperate R G and B value, and every pixel may be unique. So each pixel has (2^8) x 3 or 2^24 in color information. This is called 24bit graphics and has 16,777,216 colors. It is the most common type of image data. There is also 32bit color, but this is in reality 24bit color with either a padding or with a seperate alpha (transparency) channel. The real reason for 32bit color is that it is faster for a CPU to process 32bits at once rather than to handle 24bits, which while smaller does not align with the CPU as well.

In an indexed image it is a little different. Instead of color information, each pixel stores which entry in a color table it should use. So instead of 24bits per pixel there is 8bits. Each bit corresponding to the entry in the color table or palette. The color table dermines what those colors will be. The range of color per entry is the same 2^8 x 3 as a RGB image allows per pixel. The only limitation is the number of different shades in the image.
So, in a 24bit image, you change a pixels color by changing the information in the 24bits of color data. In an indexed one, you do it by changing the color in the color table (palette). So if you have a pixel that is 128,128,128 (50% gray) and you want it to be 0,0,255 (pure blue). You can not change the color of the pixel directly. You change the color in the palette. But, this changes the color of ALL 128,128,128 pixels to 0,0,255.

Also, if you apply a palette to an image and the same color appears in the palette twice, the paint program (or whatever imaging software) will not know which entry to use and will instead just pick the first one it finds.

This is why certain locations in the palette are reserved and why certain colors are reserved. For example with a Tech Icon (in civ3) the first two entries are reserved. This is fixed and can not be changed. By convention these first two colors are pure magenta (aka magic pink) and pure lime green (255,0,255 and 0,255,0) respectively. If you need an image with those two colors, you can in fact use any two colors in those slots. But, the colors used MUST not appear anywhere in the image. It is this fact that keeps us all using the same two reserved colors. No sober person is gonna want an image with those two shades in 'em.
note: the Photoshop and Paint Shop read an images palattes opposite of one another. So, when you look at the tech icon in Paintshop you will see that your palette looks backwards compared to these images.
Here is a tech icon I released last month with the palette used in that image.

Now with a unit the number of reserved slots goes up. The first two entire rows are shadow and smoke. The last four entire rows are civ colors (blues) and army colors.
You can use the Army colors in a unit and it is ok. But, you should probably not change these colors. If you read the unit making tutorial, it refers to a specific shade of blue as civ color. But, you can use alot of different shades of blue. Look at the palette of a unit. Look at the different shades of blue. You can even use multiple shades on the same unit. For example on my Norse Axeman, I have 4 dark and light blue stripes. The dark stripes are a couple of dark shades of blue, the light stripes are several lighter shades. In game this translates into a nicely textured shirt of the tribes colors no matter what color that might be.
If you do need different Civ colors, it is very easy to set this with Civ3FlcEdit and not worry about doing it manually. But, you still have to take care not to use the same colors elsewhere.

here is the palette of that norse axeman side by side with the palette of my Hummer Avenger. (The Norse Axeman is the one with only lime green for smoke)
Again, Paint Shop will show the palette the reversed from this.

But, the RULE is the same as with the tech icon. It is not the actual civ color which is reserved. It is the location in the table. And, the color can be changed to any color so long as that new color is not used anywhere else in the table. So, if you need a unit which is always going to have some blue, you can open a palette and change the civ colors to the same shade of RED or GREEN. (again only to make it easy on yourself).

Once you eliminate the 2 rows for smoke and shadow colors and the 4 rows for Army/Civ colors, you are left with 160 colors to work with.

Keeping these things in mind, we can now design a units color palette.
1. 160 colors to work with
2. Do not use colors in your palette that appear in the 6 rows of reserved colors. This is especially important with Civ colors.
3. A unit with out civ coloration is effectively useless in most games. It is part of the game. Including it is often the hardest part of making a unit.

Step by Step Tutorial
Steps I take in Photoshop, adjust as needed to fit your own paint program:

Creating an image with essential colorsA. Create the palette.bmpB. Use Desaturate to eliminate un-needed colors in palette.bmpC. Use the paint brush to reduce the colors in palette.bmp (Optional, can be skipped)D. Change your RGB image to an index image. E. Reduce the colors in your indexed image.F. Save your palette both as an image and as a palette.G. Create the PCX storyboard blank.H. Add your custom colors to the blank PCX.I. Add your storyboard to the PCX with the correct palette

A. Creating the palette.bmp (Creating a single image out of many storyboards. )
1. Open as many storyboards as you need to be certain you are getting every color your unit is using. Normally this will be just your most colorful storyboard, but it could include Death, AttackA, AttackB, etc... just be sure you get all the colors.
2. Select one of the storyboards.
3. Select the entire image. (ctrl + A).
4. Place this image in your copy buffer (ctrl + C)
5. Select NEW image.
6. It will propose a size based on what is in your copy buffer. Multiply this times the number of storyboards you are going to be using.
7. One by one Paste the storyboards into this common image taking care to not over lap the images (as this will reduce the colors displayed)
8. Save this image as palette.bmp

B. Eliminating un-needed colors from a RGB palette image
1. Open palette.bmp
2. in photoshop go to you the IMAGE\Adjustments\Hue/saturation. You may need to go to a different menu if your paint program is Paint Shop or GIMP.
3. Change the EDIT item from MASTER to BLUES
4. Change the Saturation and Lightness to the minimum values. In Photoshop, this is -100 for both.
5. Do the same for Magenta.

C. Eliminating un-needed colors from a RGB image with the paint brush
1. Use Magic Wand (or other method which allows the selection of specific colors).
2. Select the areas that used to be civ colored or magenta (background, shadow and smoke)
3. Select black, white, and other colors which either exactly or almost exactly match the other colors in the Army/civ portion of the palette.
4. Change the paint brush to an important color to your unit. It can be any shade at all that you wish to be certain is in your final unit. In photoshop, click on the top color of your paint brush twice. Use the eye dropper to pick up a color in your palette.bmp to paint with.
5. Paint over all your extra colors.
6. Save this as palette2.bmp

D. Changing your RGB image to an indexed one
1. In photo shop, select \image\mode\index
2. In the dialog box select 256 colors.
3. Make sure the option to force colors is set to NONE
4. Uncheck the transparencies box
6. Set the palette to either local selective or local perceptual. The first uses the actual colors by color weights in the image. The 2nd tries to sort the weights by which colors can be replaced based on similarities to other colors. The first is import if you have a dominate color theme (battleship) the second is import if you have a varied color table (humans)

E. Reducing the colors in an indexed image.
1. You need to eventually get to 160 colors. You should begin by testing. So open a couple of your original storyboards.
2. Paste a storyboard in your indexed palette2.bmp (or palette.bmp if you skipped that step).
3. Look for color discrepancies. Areas which are not displayed correctly and are not some shade your intentionally removed.
4. (optional) Look at the color table for obvious colors to combine. In photoshop \image\mode\color table
5. reduce the color in stages and optionally test along the way until you get to 160 colors.

F. Saving your palette.
1. Save your palette as .act file (just in case). In photoshop, image\mode\color table click on save, and save it as palette2.act
2. With the palette still open (from step 1), press Ctrl + Alt + Print Screen. This places a screen shot of that window in the copy buffer.
3. Close the palette
4. Select File\new and accept the default size
5. Select the new window and paste the contents of the copy buffer in to it (ctrl +V)
6. Save this as palette2.jpg

G. Creating the PCX storyboard blank
1. Open Civ3FlcEdit
2. Select the file menu \ new storyboard
3. Click on the Output tab and change the save to location to where you want your "in progress unit files"
4. Click on the frame tab and change the frame size and frame count to match your rendered images. Note Frame count is per animation, not total.
5. Click on the palette tab examine the settings and select civ color, palette type (I like ACT files) and so on to best suit you.
6. Click on the CREATE tab.

H. Adding your custom colors to the blank PCX.
This can be done with either your paint program or Pedit. I prefer Photoshop, but will cover both.
>> With Photoshop
1. Open your palette2.jpg and your bank PCX storyboard.
2. Resize your PCX so you can easily see the screen shot of the 160 colors you have in your palette.jpg screenshot
3. Select the PCX and Go to \image\mode\color table
4. Use the eyedropper and one by one add the 160 colors to the color table.
5. Save the PCX
6. Save the PCX's palette to the external palette file Civ3Flc Edit created.
>> With Pedit (alternative method, do not do this and the photoshop method as they are redundent)
1. Open your palette2.jpg and the palatte file Civ3FlcEdit create.
2. Use the eyedropper and one by one add the 160 colors to the color table.
3. Save the palette
4. Open the PCX in your paint program.
5. Go to image\mode\color table and click on LOAD and load the palette you adjusted with Pedit
6. Save the pcx

I. Adding storyboards to indexed PCX files.
1. Open the PCX file and the storyboards
2. Select the first Storyboard (click on image, and ctrl + A)
3. Place the image in your copy buffer (ctrl + C)
4. Paste this copy buffer in the PCX file (ctrl + V)
5. Save the PCX with a different name.
6. Save the palette with a matching name (image\mode\color table\ click on SAVE)
7. Repeat for each storyboard

------------------------------------------------------------------------------------------------------------------------Tips and Tricks

Note that you do not need to create storyboards for each animation so long as they are the same length and can use the same palette.

You do not have to have the same palette for each animation. So, if you are cramped on colors, ignore my advise on the single BMP for all animtions. And instead do this. Create as bas set of colors for all animations and a variable list. The variable list can be different sets of colors for attack and deathm for example. I had to do this for my BC303 unit.

You can control how dark or light the shadows are by using the 0,255,0 lime green trick I did above. As you see, I moved the shadow from the very dark image I accidentically rendered it with to the more mild one I released it with. Also, since I was cutting down on the shadow values, I did not want any of them bleeding over and becoming smoke. So, I just deleted all the smoke values.

If you review both palettes, you will see that I skipped the "paint over the army colors" step, and in fact I duplicate a couple of the army shades in my 160 colors without any problems. For some units this is cool. For those few where every color counts, than I did explain how to get every last possible color in your unit.

if your unit is mostly a monochrome (like ships) or has a dominate color you can shorten this a bit by using a color spread. In photoshop go to the palette. Select the first palette entry you want to include and drag yout mouse to the last entry. Photohsop will then prompt you for the first color and the last color and evenly spread the colors in between.

Do not be Lazy or sloppy with the tough parts. A unit with out civ coloration is effectively useless in most games. It is part of the game. Including it is often the hardest part of making a unit.

Do not forget the pedia icons. The same rule on colors as I mentioned on the tech icons are used.

Do not freak out if some minor thing goes wrong with the render. Post-process it. This means, you can edit out some issues in the BMP without re-rendering 800-1000 frames of animation.

Do not forget the "free" colors in the lower 4 rows. If a unit is getting tight on colors, using some of these is a great work around.

Take your time and be extra careful on the first few. It gets easier. Once you have done 3-4, it goes so fast you don't really even think about it.

Gray smoke works better than "civ" smoke. if you use Civ smoke and some of it touches your unit, that part will be erased in game. Gray smoke does not have this issue. The downside is that it can easily get too much of a cotten ball look.

Also, while I reccomend using your Paint program to create the palette. Or using PEdit if you have problems with your paint program. I uploaded a few palette tools you can play with if you think you need other options. You can get those here
included are:
\ACT_PAL
Pal2Act.exe -> converts palettes from PAL format to ACT format.
Act2Pal.exe -> converts palettes from ACT format to PAL format.