English

How To: Get the RGB values for all the colors in ArcView's color palette via Avenue

Summary

ArcView's palette window does not show the RGB values for the colors. You can use Avenue to generate this information.

Procedure

This script will create a dbf table with four fields: an "Index" field and a field for the red, green, and blue values.

The symdump.ave sample script will create one or more layouts of all the colors in the ArcView symbol palette. An index number for that color will be placed next to each color in the layout.

Compare the index numbers of the colors on the layout with the those in the table that results from this script for the RGB values of each color.

  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Copy this code:

    Code:
    '-- rgbtable.ave
    '-- This script creates a dbf table of the rgb values for
    '-- ArcView's color palette. Compare the index numbers to
    '-- the layout created by the AV sample script symdump.ave

    '-- Make the table
    theFile = av.GetProject.MakeFileName("rgbval","dbf")
    theVTab = VTAb.MakeNew(theFile,dBASE)
    theVTab.StartEditingWithRecovery
    idFld = Field.Make("Index",#FIELD_CHAR,16,0)
    redFld = Field.Make("Red",#FIELD_CHAR,8,0)
    grnFld = Field.Make("Green",#FIELD_CHAR,8,0)
    bluFld = Field.Make("Blue",#FIELD_CHAR,8,0)
    theVTab.AddFields({idFld,redFld,grnFld,bluFld})

    '-- Get the list of colors
    thecolorlist = av.getSymbolwin.getPalette.getList(#PALETTE_LIST_COLOR)

    '-- Populate the table with the RGB values
    for each rec in thecolorlist
    recno = theVTab.addrecord
    thergblist = rec.getrgblist
    theVTAb.SetValue(idFld,recno,recno.asString)
    theVTab.SetValue(redFld,recno,thergblist.Get(0).AsString)
    theVTab.SetValue(grnFld,recno,thergblist.Get(1).AsString)
    theVTab.SetValue(bluFld,recno,thergblist.Get(2).AsString)
    end

    theVTab.StopEditingWithRecovery(true)
    theTable = Table.Make(theVTab)
    theTable.SetName(theTable.GetVTab.GetName)
    theTable.GetWin.Open

  3. Click the
    [O-Image] Script compile button
    button to compile the script.
  4. Click the
    [O-Image] Run compiled script button
    button to run the script.