They do actually… This is the code on a listbox subclassI use to get it… written long before dark mode and I am not sure where I originally got the declares (I am not good with declares!)
[code]Public Shared Function BackgroundColor(isSelected as Boolean, Active as Boolean) as Color
If Not isSelected then Return ListBackgroundColor ’ another method … usually returns white
Dim BkgColor as Color
#if TargetCocoa
Declare Function NSClassFromString Lib “Foundation” ( name As CFStringRef ) As Ptr
Declare Function alternateSelectedControlColor Lib “AppKit” Selector “alternateSelectedControlColor” ( obj As Ptr ) As Ptr
Declare Function secondarySelectedControlColor Lib “AppKit” Selector “secondarySelectedControlColor” ( obj As Ptr ) As Ptr
Declare Function colorUsingColorSpaceName Lib “AppKit” Selector “colorUsingColorSpaceName:” (obj As Ptr, name As Ptr) As Ptr
#If Target32Bit
Declare Function redComponent Lib “AppKit” Selector “redComponent” (obj As Ptr) As Single
Declare Function greenComponent Lib “AppKit” Selector “greenComponent” (obj As Ptr) As Single
Declare Function blueComponent Lib “AppKit” Selector “blueComponent” (obj As Ptr) As Single
#else
Declare Function redComponent Lib “AppKit” Selector “redComponent” (obj As Ptr) As Double
Declare Function greenComponent Lib “AppKit” Selector “greenComponent” (obj As Ptr) As Double
Declare Function blueComponent Lib “AppKit” Selector “blueComponent” (obj As Ptr) As Double
#Endif
Static NSColor As Ptr = NSClassFromString("NSColor")
Static NSCalibratedRGBColorSpace As Ptr
If NSCalibratedRGBColorSpace = Nil Then
declare function CFBundleGetBundleWithIdentifier lib "CoreFoundation.framework" (bundleID as CFStringRef) as Ptr
Dim BundlePtr as ptr = CFBundleGetBundleWithIdentifier("com.apple.AppKit")
soft declare function CFRetain lib "CoreFoundation.framework" (cf as Ptr) as ptr
Call CFRetain(BundlePtr)
declare function CFBundleGetDataPointerForName lib "CoreFoundation.framework" (bundle as Ptr, symbolName as CFStringRef) as Ptr
NSCalibratedRGBColorSpace = CFBundleGetDataPointerForName(BundlePtr,"NSCalibratedRGBColorSpace").Ptr(0)
soft declare sub CFRelease lib "CoreFoundation.framework" (cf as Ptr)
CFRelease(BundlePtr)
End If
Dim theColor As Ptr
If Active Then
theColor = alternateSelectedControlColor(NSColor)
Else
theColor = secondarySelectedControlColor(NSColor)
End If
Dim rgbColor As Ptr = colorUsingColorSpaceName(theColor, NSCalibratedRGBColorSpace)
If rgbColor <> Nil Then
Dim red As Integer = redComponent(rgbColor) * 255.0
Dim green As Integer = greenComponent(rgbColor) * 255.0
Dim blue As Integer = blueComponent(rgbColor) * 255.0
BkgColor = RGB(red, green, blue)
Else
BkgColor = HighlightColor
End If
#else
BkgColor = HighlightColor
#ElseIf TargetMacOS
Declare function GetThemeBrushAsColor lib "Carbon" (inBrush as Integer, _
inDepth as Integer, _
inColorDev as Integer, _
outColor as ptr) as Integer
dim oc as MemoryBlock = new MemoryBlock(6)
dim res as Integer
If Active Then
If GetThemeBrushAsColor(-5, 32, 1, oc) <> 0 Then
BkgColor = HighlightColor
else
BkgColor = RGB(oc.byte(0), oc.byte(2), oc.byte(4))
end if
Else
If GetThemeBrushAsColor(-4, 32, 1, oc) <> 0 Then
BkgColor = DarkBevelColor
else
BkgColor = RGB(oc.byte(0), oc.byte(2), oc.byte(4))
End if
End if
#Elseif TargetWin32
If Active then
BkgColor = HighlightColor
Else
dim res as memoryblock
Declare Function GetSysColor Lib “user32” (nIndex As integer) As integer
res = newmemoryBlock(4)
res.long(0) = getsyscolor(0)
BkgColor = rgb(res.byte(0),res.byte(1),res.byte(2))
End If
#else
if Active Then
BkgColor = HighlightColor
Else
BkgColor = FillColor
end if
#endif
Return BkgColor
End Function
[/code]