SetGadgetColor()

Syntax

SetGadgetColor(#Gadget, ColorType, Color)
Description
Changes the color attribute specified by 'ColorType' of the given #Gadget. RGB() can be used to get a valid color value. To remove the custom color and go back to the default system color, set the 'Color' parameter to -1.

The following values are possible for the ColorType parameter: (not every gadget supports all of them)
  #PB_Gadget_FrontColor     : Gadget text
  #PB_Gadget_BackColor      : Gadget background
  #PB_Gadget_LineColor      : Color for gridlines
  #PB_Gadget_TitleFrontColor: Text color in the title        (for CalendarGadget())
  #PB_Gadget_TitleBackColor : Background color in the title  (for CalendarGadget())
  #PB_Gadget_GrayTextColor  : Color for grayed out text      (for CalendarGadget())
This command is supported by the following gadgets: (see each gadget description for the supported ColorType values.)

- CalendarGadget()
- ContainerGadget()
- DateGadget()
- EditorGadget()
- ExplorerListGadget()
- ExplorerTreeGadget()
- HyperLinkGadget()
- ListViewGadget()
- ListIconGadget()
- MDIGadget()
- ProgressBarGadget()
- ScrollAreaGadget()
- SpinGadget()
- StringGadget()
- TextGadget()
- TreeGadget()

Note: With activated Windows XP style the color settings will probably be ignored or overwritten by the style.

Example:
  If OpenWindow(0, 0, 0, 200, 170, "SetGadgetColor", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    StringGadget(0, 10, 10, 180, 20, "String...")
    ListViewGadget(1, 10, 40, 180, 60)
    For i = 0 To 4
      AddGadgetItem(1, -1, "Text")
    Next i
    ContainerGadget(2, 10, 110, 180, 50, #PB_Container_Raised)
    
    SetGadgetColor(0, #PB_Gadget_BackColor, $00FFFF)
    SetGadgetColor(1, #PB_Gadget_FrontColor, $FFFFFF)
    SetGadgetColor(1, #PB_Gadget_BackColor, $000000)
    SetGadgetColor(2, #PB_Gadget_BackColor, $0000FF)
  
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

Windows, Linux

<- SetGadgetAttribute() - Gadget Index - SetGadgetData() ->