Palette refers to the color selections available on a given camera, in a given user interface context. These affect how CHDK menus and OSD elements - including user Grids - are displayed.
This page is mainly for end-users working to create their own Grids. For developer information, see: Frame buffers
The CHDK programming defines 17 different palettes As of February 2013[update] used across various camera models and references these palettes internally to draw menus and OSD elements using appropriate colors.
Grids, however, cannot use these internal references and require a direct palette entry reference. Because these palettes can vary between camera models, user interface contexts (record vs playback, for example), creating a Grid well-suited to a specific camera is greatly eased by seeing the palette for that camera and mode.
CHDK 'Draw Palette'
The simplest method to see the palette used by a camera is through CHDK itself through its 'Draw Palette' option:
- Access the CHDK menu.
- Choose "Miscellaneous Stuff"
- Choose "Draw Palette"
This will draw a grid of palette colors (shown for SX260 HS, playback mode):
The "Color: 0x00" changes as you use your camera's navigation buttons to move to other palette entries. You can use the indicated value (0x00 through 0xff) directly in Grids and drawing commands.
Alternatively, you can check if the CHDK wikia entry for the target camera has a Palette Sheet listed. Palette sheets are created from screen captures and a bit of editing. This also makes it easier to design a Grid on a computer before transferring it to the camera.
The basic Palette Sheet consists of a title with the camera's model name and mode, columns and rows indicating decimal and hexadecimal indices for a given palette entry, and the palette for the given camera model and mode.
A template is presented here. ( Note: The template contains transparency information, open the file directly rather than copying it, as this information is usually lost. )
Creating Palette Sheets
To create a Palette Sheet:
- Take a screen capture of your camera's Palette at 1:1 without stretching.
- Use drawing tools to remove the currently selected palette entry's zoomed state, or take another screen capture with a different cell selected, combining the two captures.
- Select only the Palette grid.
- Copy the selection.
- Paste into the template at the appropriate location.
- Adjust the title to include your camera model, and mode. Suggested mode names: record, playback, menu, set. The font used in the template is Segoe UI, but is not of particular importance.
- Optional: Because transparent colors can be difficult to visualize on the web, outline transparent cells with a pure green color.
- Optional: Because CHDK partially overrides the palette on some camera models, you can outline the affected cells with a pure yellow color. You can check the source code, platform/yourcameramodel/platform_camera.h for CAM_LOAD_CUSTOM_COLORS. If this is defined as 1, look for CHDK_COLOR_BASE. Its value indicates where the camera's CHDK profile will be inserting its own colors, typically 13 in total (red, dark red, light red, green, dark green, light green, blue, dark blue, cyan, magenta, yellow, dark yellow and light yellow) but for exact details of replaced entries, see platform/yourcameramodel/lib.c and look for load_chdk_palette
- Save, or Export, the result as a PNG file, making sure that transparency information is retained.
You should then end up with a Palette Sheet something like the example shown here.
Double-check whether your camera uses different palettes in different modes and create additional Palette Sheets if warranted. Often at least record and playback use different palettes, but additional palettes may be used when in theor using