I use the CanvasGadget for some custom controls. I want the border of them to match the TreeGadget, ListIconGadget, etc., which have a border color of 197, 197, 197.
However, none of the system colors match.
Is there a color I'm missing or is there a way to get a color from another control?
Code: Select all
NewList colors.s()
AddElement(colors()) : colors() = "labelColor"
AddElement(colors()) : colors() = "secondaryLabelColor"
AddElement(colors()) : colors() = "tertiaryLabelColor"
AddElement(colors()) : colors() = "quaternaryLabelColor"
AddElement(colors()) : colors() = "systemRedColor"
AddElement(colors()) : colors() = "systemGreenColor"
AddElement(colors()) : colors() = "systemBlueColor"
AddElement(colors()) : colors() = "systemOrangeColor"
AddElement(colors()) : colors() = "systemYellowColor"
AddElement(colors()) : colors() = "systemBrownColor"
AddElement(colors()) : colors() = "systemPinkColor"
AddElement(colors()) : colors() = "systemPurpleColor"
AddElement(colors()) : colors() = "systemGrayColor"
AddElement(colors()) : colors() = "linkColor"
AddElement(colors()) : colors() = "placeholderTextColor"
AddElement(colors()) : colors() = "windowFrameTextColor"
AddElement(colors()) : colors() = "selectedMenuItemTextColor"
AddElement(colors()) : colors() = "alternateSelectedControlTextColor"
AddElement(colors()) : colors() = "headerTextColor"
AddElement(colors()) : colors() = "separatorColor"
AddElement(colors()) : colors() = "gridColor"
AddElement(colors()) : colors() = "textColor"
AddElement(colors()) : colors() = "textBackgroundColor"
AddElement(colors()) : colors() = "selectedTextColor"
AddElement(colors()) : colors() = "selectedTextBackgroundColor"
AddElement(colors()) : colors() = "unemphasizedSelectedTextBackgroundColor"
AddElement(colors()) : colors() = "unemphasizedSelectedTextColor"
AddElement(colors()) : colors() = "windowBackgroundColor"
AddElement(colors()) : colors() = "underPageBackgroundColor"
AddElement(colors()) : colors() = "controlBackgroundColor"
AddElement(colors()) : colors() = "selectedContentBackgroundColor"
AddElement(colors()) : colors() = "unemphasizedSelectedContentBackgroundColor"
AddElement(colors()) : colors() = "alternatingContentBackgroundColor"
AddElement(colors()) : colors() = "findHighlightColor"
AddElement(colors()) : colors() = "controlColor"
AddElement(colors()) : colors() = "controlTextColor"
AddElement(colors()) : colors() = "selectedControlColor"
AddElement(colors()) : colors() = "selectedControlTextColor"
AddElement(colors()) : colors() = "disabledControlTextColor"
AddElement(colors()) : colors() = "keyboardFocusIndicatorColor"
AddElement(colors()) : colors() = "controlAccentColor"
; By wilbert: https://www.purebasic.fr/english/viewtopic.php?p=419571#p419571
Procedure.i GetCocoaColor(ColorName.s)
Protected.i Result, Rect.NSRect, Image, NSColor = CocoaMessage(#Null, #Null, "NSColor " + ColorName)
If NSColor
Rect\size\width = 1
Rect\size\height = 1
Image = CreateImage(#PB_Any, 1, 1)
StartDrawing(ImageOutput(Image))
CocoaMessage(#Null, NSColor, "drawSwatchInRect:@", @Rect)
Result = Point(0, 0)
StopDrawing()
FreeImage(Image)
ProcedureReturn Result
Else
ProcedureReturn -1
EndIf
EndProcedure
ForEach colors()
color = GetCocoaColor(colors())
Debug colors() + " = " + Str(Red(color)) + ", " + Str(Green(color)) + ", " + Str(Blue(color))
Next