Khroma Reference (v1.1)
Khroma is a simple program which allows interactive selection of colors for the PalmOS user interface. It is intended primarily as a developer's tool but could be used by anyone who wants to add a bit of color to the basic palm applications and other monochrome programs on color handhelds. Khroma only runs under PalmOS 3.5 or higher and preferably on color handhelds or emulators. Grayscale devices using OS 3.5 or above are supported but useful gray schemes are understandably limited. Khroma has been tested extensively under IIIc emulation (OS 3.5 and 4.0), m505 emulation (OS 4.0) and Palm Vx (OS 3.5) and Visor Prism (OS 3.5.2) hardware. Other similar handhelds running these OS versions should work fine but have not been specifically tested.
Khroma works with the UIColorTable and UIColorTableEntries list APIs introduced with the IIIc and OS v3.5. Colors are selected using small popup palettes for each color item. Once colors have been selected they can be saved as a 'color scheme', reloaded and edited. The UIColorTableEntries tags and associated color values (index into system table and rgb values) can be displayed and exported (currently only into the Memo database). Memos in the Khroma format can be imported into a scheme. Exporting and importing via memos allows schemes to be edited, copied, beamed and shared like other memo records. A color scheme may be installed as a UIColorTable (technically by writing a 'tclt' resource for the current Khroma screen depth to the system's saved preferences file). This table is used by the system for default colors and will be used in all applications that do not themselves modify the UIColorTable or UIColorTableEntries list. The stock default system colors can be easily restored.
In general, any program which does not install its own UIColorTable or write its own colors to the UIColorTableEntries list should work well with utilities like Khroma. Given that the color handhelds are relatively new, there are scads of programs which are compatable. Some caveats apply, however. 1) Icons or bitmaps are sometimes used as specialized interface components. Regardless of the shape of the icon or bitmaps's image, it is created as a rectangular structure. The unused 'background' pixels of the rectangle are usually colored white and are opaque to any background color by default. Such icons operate fine with colored backgrounds but look clunky if not ugly. The fix is to provide an icon or bitmap family instead of a single icon or bitmap. Set the transparent flag and set the transparent color to the icon's background color. This is a quick recompile and really improves the interface appearance. 2) Games are notorious for working close to the hardware when rendering their graphics. Although I have only been told of one game which conflicted (Zap2000) I would be very surprised if many games worked well with Khroma. 3) The Palm's Launcher works very nicely with Khroma. Icons without transparency may not look great but there are utilities (such as the icon transparency plug-in for Launch'Em) which will fix some of these. Other launchers which colorize themselves, in particular MegaLauncherII and Launch'Em, don't use many if any of the default system colors.
My preference would be for programs to give users the option of using either a color set provided in code or the default system colors. This would be simple to implement and would be very user friendly. Utilities like Khroma could then be used to create a coherent 'look and feel' across all applications on an individual device.
The only other program I have run across with similar functionality as Khroma is Chrome (David Williams www.twinkletwinkle.com). Schemes created in these programs can be exchanged by writing a color scheme to the UIColorTable (using the <System:Install UIColorTable> menu item in Khroma or the <Apply> button in Chrome), quitting and then launching the other program. The new scheme is usually opened automatically. When transfering a Chrome scheme to Khroma do the following:
- In Khroma, remove any installed Khroma table by selecting the <System:Remove UIColorTable>.
- Open the preferences dialog and set the -Startup with- item to <Table>.
- Quit Khroma.
- Start Chrome.
- Make the color choices in Chrome and click <Apply>
- Quit Chrome.
- Restart Khroma.
Khroma will startup with a new, unsaved scheme filled in with the colors selected in Chrome.
Color Selection
The active color assignments are displayed as color 'chips'. Tap a color chip to activate a popup color palette. Tap just once and it will remain open until a second tap. Tap and drag to select a color. The current color selection and its values are displayed in the swatch along the palette bottom. Tapping or dragging outside the palette cancels, leaving the active color unchanged. The chip labels are abbreviated versions of the full UIColorTableEntries tags shortened to fit - hopefully they are decipherable. In any case, the full tag names are displayed with the associated color index and rgb values by selecting the <Options:Display color data> menu item.
Tabs and UI Element Groups
The tabs allow navigation between various groups of interface elements. Because the form and menu entries are in a sense ubiquitous they are always available above the tabs. When appropriate, demo elements are included to check out how the colors look. The tab labels are abbreviations of Palm's basic groupings: Obj(Objects), Fld(Fields), Dlg(Dialogs), and 2 of my own: Win(Windows), Oth(Others).
- Objects include controls such as buttons and checkboxes, lists, popups, and label text.
- Fields are essentially any editable text. Interestingly the background color used in icon displays such the Launcher's icon and list views is set using the field background entry.
- Dialogs have both the
- Windows tab allows setting of the window color drawing states ( foreColor etc.). While not part of the UI color table, it is useful to have this functionality. It is a convenient way to choose drawing colors in the context of the UI, save them and get at their color values.
- Others includes other entries for FEP and alert icons. The former are 'front end processor' entries for raw and converted text fields. The documentation is sketchy but these entires appear to apply to wide, two-byte character text as would be used on Japanese devices. The alert icon entries are not used by the OS as of yet. I suppose one could appropriate them for one's own purposes but then one's software might break later on. ;-)
<File:New> starts a new color scheme using stock system colors (black&white or blue&white).
<File:Open> brings up a dialog for selection of saved color schemes.
<File:Save> writes any changes in the active scheme to the database.
<File:SaveAs> prompts for a color scheme name and saves the active scheme in the database under this name.
<File:Revert> restores the last saved color set discarding any changes to the scheme.
<File:Export...> exports the UIColorTableEntries list and associated color data to a memo record. The memo name may be edited before export. The dialog stays open until the <Done> button is pushed so any number of schemes can be sequentially exported during one session with the dialog.
<File:Import...> imports color data stored in a memo (formatted appropriately) into a scheme. As with exporting, sequential memos can be imported during one dialog session.
<File:Delete> Completely deletes the active scheme from the database. (No b/u).
<System:Adjust brightness...> Does various things depending on the device. On the Palm Vx it toggles the backlight off and on, on the IIIc and Prism it brings up a screen brightness adjuster, and on the m505 it does nothing.
<System:Set screen depth...> Allows the current screen depth to be changed and optionally used as the system default. (If the <Remember depth> option in the preferences filed is checked, the current depth will be used when Khroma is restarted regardless of the system default depth).
<System:System color picker> allows color browsing using the system's palette picker or rgb sliders. The selected color is then displayed as the fill in an alert form along with its index and rgb values.
<System:Install UIColorTable> Sets up UIColorTable for the current screen depth using the active schemes colors. This makes the schemes colors available system wide.
<System:RemoveUIColorTable> does just that. It removes the 'tclt' resource so that the original system colors will be used ( Black and white on grayscale machines, mostly blue and white on color). This only removes the color table installed for the current Khroma screen depth.
<System:Load system defaults> loads the colors from UIColorTable for the current depth into the active Khroma scheme. If the table was installed by Khroma, the associated scheme is opened from the scheme database. If was not installed by Khroma, the colors are loaded only.
<Options:Preferences> brings up the preferences dialog! The available preferences settings are:
- -Startup with:- Determines what scheme Khroma will use at start up. <New> opens a new, unsaved scheme with the stock system colors, <Last> opens the last active scheme before Khroma was quit, <Table> starts up with the current UIColorTable's color set and the associated scheme (if a Khroma table) or a new, unsaved scheme (if a non-Khroma table).
- -Save changes:- If you want to be prompted to save changes ( eg before opening another scheme or quitting Khroma) select <Ask>. Selecting <Always> will make saves automatic, selecting <Never> will always discard changes.
- -Remember screen depth:- Screen depth can be changed within Khroma without disturbing the default system depth. If you want to startup with the depth you last worked with in Khroma regardless of the default system screen depth, check this option. When unchecked Khroma will startup with the systems default depth.
- -Display color values as:- Sets the number base to use for color values in the screen color data display (vide infra) and in the memo exports. <Dec> decimal or <Hex> hexadecimal.
<Options:Display color data> displays the UIColorTable Entries tags and corresponding color index and rgb values in a dialog. A button is provided to export to a memo.
<Options:About Khroma...> brings up a dialog with some useful info including most of this text under the info icon.
This software is freeware. Use it, give it to your friends, cuss at it but please do not sell it. I will support it to the best of my ability but my ability may vary with the vicissitudes of life. I always welcome constructive criticism and suggestions and am happy to provide source code for the curious.
Béla B. Hackman
bbhack@wspice.com
March 2001, May 2001