Ummm... This is a really clever solution, except if you have a hex value that you need to convert into an rgb array, it is probably a string, not an integer literal. Is there an easy way to convert a hex string directly into an integer literal? (not that anybody is still watching this thread, but I figured I'd ask) Martin DeMello wrote: > On 8/10/06, Bruno Malvestuto <bruno / garageim.com> wrote: >> How i can convert hex to rgb? > > hex = 0xffeedd > rgb = {} > %w(r g b).inject(hex) {|a,i| rest, rgb[i] = a.divmod 256; rest} > p rgb > > martin -- Posted via http://www.ruby-forum.com/.