str = (color.red >> 8).to_s(16)
str += (color.green >> 8).to_s(16)
str += (color.blue >> 8).to_s(16)

> Date: Tue, 11 Aug 2009 20:48:47 +0200
> From: ruby-forum-incoming@andreas-s.net
> To: ruby-gnome2-devel-en@lists.sourceforge.net
> Subject: [ruby-gnome2-devel-en] Gdk::Color to HTML Format Hex
>
> I'm trying to convert the hex code that Gdk::Color.to_s() returns into
> HTML Format Hex. I think what needs to be done is some math on the
> string, but I'm fairly new to ruby and not sure how to do this. For
> instance, if the color in HTML hex is a six string code, #ffffff, then
> Gdk::Color would return #ffffffffffff.
>
> Here is an example of how to do it in C, but I'm not sure how to
> translate that to ruby.
>
> http://volatile-minds.blogspot.com/2009/04/gdkcolor-html-hex-string.html
>
> Thanks in advance.
> --
> Posted via http://www.ruby-forum.com/.
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> ruby-gnome2-devel-en mailing list
> ruby-gnome2-devel-en@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en


Internet Explorer 8 - accelerate your Hotmail. Download Internet Explorer 8