Syntax
Success = SkinGetColor(Path$, State$, Component$, Property$, *Color.Long, *Opacity.Float, Skin=#Null)
Description
Retrieves the computed color and opacity for a specific skin property that represents a color (like `background-color`, `color`, `border-color`, etc.). This is a convenience function that uses SkinGetData() internally.
Parameters
Path$
The widget class selector path (e.g., "window.button", "mylistview").
State$
The widget state (e.g., "", "hover", "active"). An empty string targets
the base state.
Component$
The specific component within the widget (e.g., "", "thumb"). An empty
string targets the main element.
Property$
The name of the color-related skin property to retrieve (e.g.,
"background-color", "color").
*Color.Long
A pointer to a Long variable that will receive the RGB color value.
*Opacity.Float
A pointer to a Float variable that will receive the opacity value
(0.0 to 1.0).
Skin (optional)
The handle of the skin object to query. If #Null,
the current default skin is used. Default is #Null.
Return Value
Returns #True if the specified property was found for the given path/state/component in
the skin and it represents a color value. Returns #False otherwise (e.g., property not
found, skin invalid, or property is not a color type).
Remarks
This function simplifies retrieving color information compared to using SkinGetData() directly and checking the returned type. It accesses the internally stored, parsed color data.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
; Assume a skin is loaded or created and set as default
SkinSetValue("mywidget", "", "", "color", "rgba(255, 0, 0, 0.5)") ; Semi-transparent red
SkinSetValue("mywidget", "hover", "", "color", "blue")
MyWindow = CreateWindow(0, 0, 300, 200, "Get Skin Color")
MyWidget = CreateWidget(10,10,100,30)
WidgetSetClass(MyWidget, "mywidget")
If MyWindow
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
; Get the base color
If SkinGetColor("mywidget", "", "", "color", @BaseColor.l, @BaseOpacity.f)
Debug "Base Color: " + Hex(BaseColor) + ", Opacity: " + StrF(BaseOpacity, 2)
Else
Debug "Base color not found."
EndIf
; Get the hover color
If SkinGetColor("mywidget", "hover", "", "color", @HoverColor.l, @HoverOpacity.f)
Debug "Hover Color: " + Hex(HoverColor) + ", Opacity: " + StrF(HoverOpacity, 2)
Else
Debug "Hover color not found."
EndIf
Repeat : Event = WaitWindowEvent() : Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()
See Also
SkinGetData, WidgetGetSkinColor (preferred method inside widget handlers), SkinSetValue
Supported OS
Windows, Linux