Creating Custom Colors and Gradients
Conveniently, Macromedia has incorporated the Web-safe color palette into the swatches in Flash. Often, however, you may need to use a color located on a different swatch, or you may want to create gradients using your own color choices.
Therefore, we'll take a look at a couple of panels in Flash. The first is the Color Swatches panel; the second is the Color Mixer panel. Each can be used to select different colors; however, the Mixer panel gives you precise control over certain color properties.
In the Color Swatches panel, shown in Figure 3.25, you can sort colors, load different swatch sets, and even load bitmap graphics. To import different swatch sets, click in the top-right corner of the Color Swatches panel to access the drop-down menu. Choose Add Colors, find a Flash color set file (typically located in your Flash MX program folder), and select it. This will add any additional swatch sets to the panel. However, if you choose Replace Swatches, all existing swatches will be replaced with the new loaded set.
If you've added and arranged this panel in a way that feels comfortable to you, consider making it the default. In the submenu, choose Save as Default so that every time you open Flash, these color swatches will be loaded in the panel.
However, if you feel that the swatch set you've customized is good only for certain occasions, you can simply save that swatch set as a swatch. In the submenu, choose Save Colors, which will launch the Export Color Swatch window. Name the color set and save it in an easily accessible location, such as in the Flash program folder under \en\First Run\Color Sets.Figure 3.25 The Color Swatches panel.
The Color Mixer panel is a bit more robust in comparison to the Color Swatches panel. Notice how much the Color Mixer panel offers in Figure 3.26.Figure 3.26 The Color Mixer panel.
The Color Swatches panel is best for accessing stored colors. The Color Mixer panel, on the other hand, is used in customizing colors and gradients. After you've created these custom colors, you can store them in the Color Swatches panel. Therefore, these two panels work well together.
At first glance, you'll see that the Color Mixer panel has a nice color ramp from which you can choose colors. As you take a closer look, you should also notice the many different ways to come up with certain colors.
By default, you can type in numbers for the red, green, and blue (RGB) values. This can be useful, especially if you're working with a graphics application such as Fireworks or Photoshop to create artwork. If you need to match a certain color element in that graphic, you can get an RGB or HSB readout in the other program and type those values into this swatch. You can easily change the RGB values to display hue, saturation, and brightness by choosing the appropriate option in the Color Mixer's submenu.
Accessing Custom Colors Using the Color Picker
Here are the steps to follow to access custom colors using the Color Picker:
Open the fill swatch and choose the color wheel in the top-right corner of the palette. This will open the Color Picker dialog box. In Windows, the Color Picker dialog box looks like an overgrown Color Mixer panel. You have the color ramp, where you can select a custom color and even add that custom color to a custom swatch within the dialog box. The Mac, however, is quite different. (Notice that on the Mac, if you move the dropper away from the color swatches, you can sample any color on your computer screen.) You can see the Mac RGB Color Picker in Figure 3.27.
By default, the RGB Color Picker will appear. In this dialog box, you can choose a color by moving the percentage sliders from left to right. Moving them to the right will increase the amounts of the corresponding colors to higher percentages.
Move the Red slider to 100%.
Move the Green slider to 0%.
Move the Blue slider to 0%. Notice the color difference between the original color and the new color. The end result is a pure red. Often you'll need to refer to some numbers generated during content development so that you can match certain pieces or areas of artwork.
Move the slider next to the color ramp to reveal a selection of colors.
Choose the desired color. Notice that all these colors have a corresponding hexadecimal value. These hexadecimal values are Web-safe colors. A Web-safe color is a color commonly shared between a Macintosh and a Windows machine if you drop them down to their lowest 256, 8-bit color display. There are only 216 Web-safe colors.
Choose a color by clicking anywhere on the color wheel.
Use the slider on the right to adjust the brightness.
Figure 3.27 The RGB Color Picker on the Macintosh.
Figure 3.28 shows the Name Color Picker window on the Macintosh.
Figure 3.28 The Name Color Picker on the Macintosh.
Figure 3.29 shows the HSV Color Picker window on the Macintosh.
Figure 3.29 The Hue, Saturation, and Value (HSV) Color Picker on the Macintosh.
If you are new to Web development, be aware that even though 216 colors are commonly shared between the Mac and Windows operating systems, a Mac's colors are generally brighter, and the Windows colors are commonly darker. However, using Web-safe colors seems to be less and less an issue with modern-day machines displaying well over a million colors.
The slider underneath the color wheel will adjust the value. Moving the crosshairs around in the color wheel will adjust the hue angle as well as the percentage of the saturation.
The Crayon Color Picker allows you to choose a color with a specific name. These colors are not necessarily Web-safe colors. The Crayon Color Picker offers an assortment of nicely organized, easy-to-find colors as shown in Figure 3.30.Figure 3.30 The Crayon Color Picker on the Macintosh.
The CMYK section is a color mixer that uses the common four-color print process of cyan, magenta, yellow, and black. As mentioned earlier, Web-safe colors are becoming less of an issue. However, you could find yourself in a situation in which your company wants a CMYK color to be used throughout its Web site. Commonly, this happens with logos. To keep in line with company standards, you may choose to use the exact colors printed in the logo. Ultimately, this will result in a consistent look throughout the Web site. Refer to Figure 3.31 for the CMYK Color Picker.Figure 3.31 The CMYK Color Picker on the Macintosh.
Changing a Color's Alpha
A great feature of Flash is the ability to change the alpha of a color. The Alpha setting controls how opaque or how transparent a color will be. The default is set to 100% but can be lowered all the way down to 0%. This can be useful in animationsperhaps you'd like an object to fade in or out, or you may want an item to cross over another item, in which case you may want to see the item underneath.
To change a color's alpha, choose the desired color in the fill swatch. Next, use the slider to the right of the Alpha field to lower the percentage of the alpha. You may also type in a value in the Alpha field. The lower the alpha percentage, the more transparent the color will become.
After the color has been set, you can use this new transparent color just as you would any other color. In fact, you can even save it in the swatch set.
Saving a Color to a Swatch
It's quite simple to save any custom color you've created or selected. With the custom color in the fill or stroke swatch selected, move your cursor into the Color Swatches panel. When your cursor is in an empty area of the swatch, it turns into a Paint Bucket tool. Click an empty area and notice that the color has been added to fill the empty area with the selected fill color. You can also add a color by choosing a color in the Color Mixer panel, activating the submenu, and choosing Add Swatch.
With all these options in the Color Mixer, you may find yourself with many custom colors. After you've added these colors to the Color Swatches panel, it may be a good idea to save them as a swatch.
Modifying and Creating Gradients
The Color Mixer panel is an area where you can modify existing gradient colors by changing, adding, or deleting the colors that make up any given gradient. When you have a gradient selected in the fill swatch, notice the new options in the Color Mixer panel.
In Figure 3.32, the drop-down menu contains choices for a radial gradient and a linear gradient. Also, take note of the new color ramp for the gradient. Each triangle marker in the ramp is a color that will be represented in the gradient. If you're working with a simple two-color gradient (for example, from white to black), these two colors will gradually intersect one another.Figure 3.32 The Color Mixer panel with a gradient as the active fill.
Modifying a Color Gradient
Here are the steps to follow in order to modify a color gradient:
Draw a circle with no stroke and a radial gradient selected for the fill.
To change the gradient's colors, highlight one of the markers in the gradient ramp located in the Color Mixer panel.
With the triangle selected, open the Ink Well tool above the ramp in the Color Mixer panel and choose a new color. Notice that the gradient is automatically updated.
Select the other marker and change its color as well.
To edit this gradient further, you can add even more color by adding additional markers to the gradient ramp. To create a new midrange color in the gradient, simply click in an empty area just underneath the gradient ramp. Notice the new marker with a midrange color.
Change the new marker's color by using the Color Picker tool in the Color Mixer panel.
You can add as many new markers as necessary to achieve the desired effect. To remove any unnecessary markers, click and drag them down and away from the color ramp.
When the gradient is complete and you feel you might use the new gradient color later down the road, you may want to save it in your Color Swatches panel. Select the submenu in the Color Mixer panel and choose Add Swatch.
Be sure to check out the instructional QuickTime movie on how to create custom gradients located on this book's companion Web site, http://www.samspublishing.com.