This function returns a compound widget to modify a color value associated with an RGB image using the RGB, HLS, or HSV color system. The function returns the base ID of the widget, and an interactive ENVI Classic session is required to run. An interactive ENVI Classic session is required to run this function.


Result = WIDGET_RGB(Base [, AUTO_MANAGE={0 | 1}] [, /BIT_24] [, INDEX=value], UVALUE=value)



This is the ID of the base widget.


AUTO_MANAGE (optional)

Use this keyword to specify how ENVI Classic auto-manages the widget with AUTO_WID_MNG. The keyword value specifies if the widget must have a defined value. Setting this keyword to a value of 1 requires that the widget has either a default value or a value that you enter. Setting this keyword to 0 does not require a value. Do not use this keyword for user-managed widgets.

BIT_24 (optional)

Set this keyword to specify 24-bit color.

INDEX (optional)

Use this keyword to select the color table index to edit. The default value is 0.


Use this keyword to assign a “user value” to the widget. This value may be of any data type and organization. The user value exists entirely for your convenience. For widgets managed by the ENVI Classic function AUTO_WID_MNG, UVALUE is a tag name in the returned anonymous structure. For user-managed widgets, you can set and use UVALUE however you wish. You must set UVALUE for all compound widgets.

Widget Event

When the widget is not auto-managed, widget events set event.result to a byte array of three elements (RGB), regardless of the color system. User-managed widgets can use WIDGET_CONTROL SET_VALUE to change the color index being edited. In this case, you should set SET_VALUE to a three-element array of RGB values for the current index. Or, you can set SET_VALUE to a four-element array, where the fourth value is a new color index to edit.

You can use WIDGET_CONTROL GET_VALUE to return the current RGB three-element array. The inputs and outputs from SET_VALUE and GET_VALUE are always RGB, regardless of the color system selected.


Create a simple compound widget to modify the fifth color in the ENVI Classic graphic color table. If the color is properly modified, then output the new RGB color triplet.

  compile_opt IDL2
  base = widget_auto_base(title='RGB test')
  we = widget_rgb(base, index=5, uvalue='rgb', /auto)
  result = auto_wid_mng(base)
  if (result.accept eq 0) then return
  print, 'New RGB color triplet= ', result.rgb

API Version