[Gambas-user] How Gambas determine if the desktop is dark?

Martin Belmonte mbelmonte at belmotek.net
Tue Jul 7 12:11:26 CEST 2020


Perfect.

I followed the method of color luminance and as I use version 3.14 I 
used the code snippet from the gambas ide sources like.

             hColor = Color[Color.ButtonBackground]

             If hColor.Luminance > 160 Then
                 Paint.Brush = Paint.Color(Color.Black)
             Else
                 Paint.Brush = Paint.Color(Color.White)
             Endif

Tanks.

Martín.


El 6/7/20 a las 16:23, Benoît Minisini escribió:
> Le 06/07/2020 à 15:45, Martin Belmonte a écrit :
>> Hi,
>>
>> What method uses Gambas to determine if the desktop theme is dark or 
>> light?
>> I try to find out so that the programs I made with Gambas adapt to 
>> the desktop in other aspects beyond the standard icons and the color 
>> of the text.
>> Specifically I use paint to draw by code the images that I will show 
>> in drawing tools.
>> Regards.
>>
>> Martín.
>>
>
> The Application.DarkTheme property is TRUE if:
>
> - The luminance of the default background color is lower or equal than 
> 50%.
>
> - Or if the GB_GUI_DARK_THEME environment variable is set to an 
> integer number different from zero.
>
> Regards,
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200707/0f42a212/attachment.html>


More information about the User mailing list