[Gambas-user] System colors

Bruce Steers bsteers4 at gmail.com
Fri May 5 12:07:22 CEST 2023


On Fri, 5 May 2023 at 11:02, Bruce Steers <bsteers4 at gmail.com> wrote:

>
>
> On Fri, 5 May 2023 at 10:28, Martín <mbelmonte at belmotek.net> wrote:
>
>> Hi,
>>
>> I do the following to get the system colours, but it only works with the
>> constants. How can I get the values of the following properties?
>>
>>    Dim xColor As Class = Classes["Color"]
>>    Dim sSymbol As String
>>
>>    For Each sSymbol In xColor.Symbols
>>      Select xColor[sSymbol].Kind
>>        Case Class.Constant
>>          $aColors.Add([xColor[sSymbol].Value, sSymbol])
>>        Case Class.Property
>>          Print "Property: " & sSymbol
>>        Case Class.Variable
>>          Print "Variable: " & sSymbol
>>      End Select
>>    Next
>>
>> How I can obtain it in a simple way the default system colors?
>>
>
this..
   For Each sSymbol In xColor.Symbols
     Select xColor[sSymbol].Kind
       Case Class.Constant
         Print "Constant: ", sSymbol, Object.GetProperty(Color, sSymbol)
         $aColors.Add([xColor[sSymbol].Value, sSymbol])
       Case Class.Property
         Print "Property: " & sSymbol, Object.GetProperty(Color, sSymbol)
       Case Class.Variable
         Print "Variable: " & sSymbol
     End Select
   Next
produces this...
Constant:       Red     16711680
Constant:       Blue    255
Constant:       Cyan    65535
Constant:       Gray    8421504
Constant:       Pink    16744703
Constant:       Black   0
Constant:       Green   65280
Constant:       Royal   33023
Constant:       White   16777215
Constant:       Orange  16744448
Constant:       Purple  16711808
Constant:       Violet  8388863
Constant:       Yellow  16776960
Constant:       DarkRed 8388608
Constant:       Default -1
Constant:       Magenta 16711935
Constant:       SoftRed 16744576
Constant:       DarkBlue        128
Constant:       DarkCyan        32896
Constant:       DarkGray        4210752
Constant:       SoftBlue        8421631
Constant:       SoftCyan        8454143
Constant:       DarkGreen       32768
Constant:       DarkRoyal       16512
Constant:       LightGray       12632256
Constant:       SoftGreen       8454016
Constant:       SoftRoyal       8438015
Property: Background    16184820
Constant:       DarkOrange      8404992
Constant:       DarkPurple      8388672
Constant:       DarkViolet      4194432
Constant:       DarkYellow      8421376
Property: Foreground    3028022
Constant:       SoftOrange      16760960
Constant:       SoftPurple      16744640
Constant:       SoftViolet      12615935
Constant:       SoftYellow      16777088
Constant:       DarkMagenta     8388736
Constant:       SoftMagenta     16744703
Constant:       Transparent     -16777216
Property: LinkForeground        1796811
Property: TextBackground        16777215
Property: TextForeground        0
Property: LightBackground       7186668
Property: LightForeground       12106930
Property: ButtonBackground      15855598
Property: ButtonForeground      3028022
Property: TooltipBackground     855638016
Property: TooltipForeground     16777215
Property: VisitedForeground     1397662
Property: SelectedBackground    3507428
Property: SelectedForeground    16777215

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230505/965568bd/attachment-0001.htm>


More information about the User mailing list