Form colors

Linux specific forum
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Form colors

Post 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?
Missed it by that much!!
HK
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Form colors

Post 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
The Stone Age did not end due to a shortage of stones !
broozar
User
User
Posts: 61
Joined: Sat May 08, 2010 11:21 pm
Location: Berlin, Germany

Re: Form colors

Post 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.
User avatar
Shardik
Addict
Addict
Posts: 2067
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Form colors

Post 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?
Post Reply