Page 1 of 1

Form colors

Posted: Fri Mar 06, 2015 9:38 pm
by harkon
I'm looking to get the default color for the form background. In Windowz I can query the registry and find thos values. Where does Linux stire those color values and how do I retreive them?

Re: Form colors

Posted: Fri Mar 06, 2015 10:23 pm
by StarBootics
I have spend a lot of time find this out and finally I gave up and came up with this solution :

Code: Select all

Procedure.l FindWindowBackgroundColor(Window)
  
  If StartDrawing(WindowOutput(Window))
    Color.l = Point(3, 3)
    StopDrawing()
  EndIf
  
  ProcedureReturn Color
EndProcedure
Is not elegant but it work !

Best regards
StarBoortics

Re: Form colors

Posted: Sat Mar 07, 2015 1:32 pm
by broozar
since pretty much all linux desktop environments can be themed, i do not believe there is such a thing as the default form background color. It all depends on the desktop environment and the current theme.
Where does Linux stire those color values and how do I retreive them?
as an xfce user (which is gtk2-based), i can tell you that the current theme settings are store in ~/.gtkrc-2.0, which in my case refers to a preinstalled theme named "Clearlooks-Phenix" located in /usr/share/themes/Clearlooks-Phenix. If it were a custom theme, it could also be in ~/.themes/. From here, depending on which desktop environment you are running, you can go to the subfolder that your DE uses as UI library, like "gtk-2.0", "gtk-3.0", "metacity-1" etc. which all contain files related to theming and coloring, like gtkrc, css and xml documents. There is no overall standard to any of this.

if you want to theme your application independent of the current user theme, it's probably easier to ship your own colors with the help of e.g. a gtkrc file, like so http://www.purebasic.fr/english/viewtop ... 15&t=58981

I am sure there is another way of querying the colors directly, since other languages have them, like http://stackoverflow.com/questions/3036 ... ound-color, but i don't know them for PB.

Re: Form colors

Posted: Sat Mar 07, 2015 2:42 pm
by Shardik
Have you already taken a look into the thread How to get default window background colour? and tried out the examples by remi_meier and me?