Re: Gdk.color GTree.column ?

Eddy2 <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Hi,


Sebastien Ferre-2 wrote:
> 
> Is it possible to represent any color as a string ? I only
> know the common colors as strings (e.g., white, blue, ...).
> 

Yes you can do that ! In my first reply on this thread I gave you a piece of
code which build a #RRGGBB string (for example "#0000FF" is a
well-understood synonym of "green") and use it to fill the cell background.
It's also very easy to build this string from RGB integers using
Printf.sprintf :

let string_of_rgb = Printf.sprintf "#%02x%02x%02x"
let rgb_of_string s = Scanf.sscanf s "#%2x%2x%2x" (fun r g b -> r, g, b)

But obviously you have to use "background" instead of "background-gdk" when
setting the corresponding attribute. For instance :

view_column#add_attribute cell_text "background" bg_color

Hope this helps,
Eddy

-- 
View this message in context: http://www.nabble.com/Gdk.color-GTree.column---tp18339824p18356225.html
Sent from the Lablgtk - France mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.