* * *

Author Topic: How to determine (cross platform) Theme Colors?  (Read 370 times)

Hansaplast

  • Sr. Member
  • ****
  • Posts: 446
  • Tweaking4All.com
    • Tweaking4All
How to determine (cross platform) Theme Colors?
« on: September 12, 2018, 11:51:11 am »
I know that controls are done natively where possible and that's great.
I also know we have predefined system colors (clBtnFace, etc), however, unfortunately, these colors are hardcoded and do not pay attention to whatever colors a theme may be using.


Now that I'm working with for example alternating row colors in a TListBox, I'd love to be able to set it to colors that are used by the theme of the OS.


Is there any way to determine these colors?


Example;
I have a TListBox, with alternating line colors. I used a light yellow color for the even lines and the default color for odd lines, and the default font color.
Unfortunately, with the increased popularity of Dark themes, the listbox becomes completely unreadable on some systems. Ideally, and probably impossible, the defined system colors adapt to whatever theme is seen. As that is most likely not an option, I wouldn't mind coding colors accordingly myself based on the OS Theme - I just need a method to detect the actual system colors.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus