Determine the RGB specifications for the colors used in an ArcGIS graph


Instructions provided use the following VBA macro to list the RGB values for the colors used in a graph.


  1. Open the map document that contains the graph.
  2. Paste the following code into VBA:


    Sub OutputGraphColors()

    Dim RGBColorArray(16) As String
    ' assign array values based on IDataGraphColorTable documentation
    RGBColorArray(0) = "0,0,0" 'Black
    RGBColorArray(1) = "0,0,128" 'Blue
    RGBColorArray(2) = "0,128,0" 'Green
    RGBColorArray(3) = "0,128,128" 'Cyan
    RGBColorArray(4) = "128,0,0" 'Red
    RGBColorArray(5) = "128,0,128" 'Magenta
    RGBColorArray(6) = "128,128,0" 'Brown
    RGBColorArray(7) = "192,192,192" 'Light Gray
    RGBColorArray(8) = "128,128,128" 'Gray
    RGBColorArray(9) = "0,0,255" 'Light Blue
    RGBColorArray(10) = "0,255,0" 'Light Green
    RGBColorArray(11) = "0,255,255" 'Light Cyan
    RGBColorArray(12) = "255,0,0" 'Light Red
    RGBColorArray(13) = "255,0,255" 'Light Magenta
    RGBColorArray(14) = "255,255,0" 'Yellow
    RGBColorArray(15) = "255,255,255" 'White

    Dim pDataGraphs As IDataGraphs
    Set pDataGraphs = ThisDocument
    Dim pDataGraph As IDatagraph
    Set pDataGraph = pDataGraphs.Item(0) 'first graph
    Dim pDataGraphColorTable As IDataGraphColorTable
    Set pDataGraphColorTable = pDataGraph
    Dim i As Integer
    For i = 0 To pDataGraphColorTable.size - 1
    Debug.Print RGBColorArray(pDataGraphColorTable.ColorRGB(i))
    Next i

    End Sub

  3. Change the Item index to view a graph other than the first graph in the map.
  4. Run the macro.
  5. Open VBA's Immediate window to see the results.
  6. If there are more graph markers in the graph, for example: bars, columns, pie slices than colors listed, then the colors are repeating in the graph in the order listed.
  7. Change the assigned colors, and the order in which they are listed by using the ArcMap Advanced Settings Utility. This application is installed with ArcGIS and can be found in the \ArcGIS\Utilities folder.
  8. Use the ArcMap Advanced Settings Utility to identify color values greater than 15.

Article ID:000006544

  • ArcMap 8 x
  • ArcMap 9 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic