The Element.getStyle returns color values as RGB, I don''t understand why and would really like a hex value instead. Do I have to convert it myself somehow? Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
See parseColor in effects.js On 1/15/07, Daniel Eben Elmore <danielelmore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > The Element.getStyle returns color values as RGB, I don''t understand why and > would really like a hex value instead. Do I have to convert it myself > somehow? > > > Daniel > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you Andrew -----Original Message----- From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Andrew Kaspick Sent: Monday, January 15, 2007 3:04 AM To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails-spinoffs] Re: RGB to HEX See parseColor in effects.js On 1/15/07, Daniel Eben Elmore <danielelmore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > The Element.getStyle returns color values as RGB, I don''t understand whyand> would really like a hex value instead. Do I have to convert it myself > somehow? > > > Daniel > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Daniel Eben Elmore wrote:> The Element.getStyle returns color values as RGB, I don''t understand why and > would really like a hex value instead. Do I have to convert it myself > somehow?Hi Daniel, It''s actually not Element.getStyle that does that but the browser itself (at least that''s the case for Safari and Firefox). Regards, Tobie Langel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/15/07, Daniel Eben Elmore <danielelmore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > The Element.getStyle returns color values as RGB, I don''t understand why and > would really like a hex value instead. Do I have to convert it myself > somehow?Different browsers may return different formats. I think that in IE if the background is set to "green" then currentStyle will return "green". If the background is set to hex then hex will be returned. In Firefox it will return RGB in both cases, I believe. Peter -- JavaScript for Rails: http://forkjavascript.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Peter Michaux wrote:> On 1/15/07, Daniel Eben Elmore <danielelmore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > The Element.getStyle returns color values as RGB, I don''t understand why and > > would really like a hex value instead. Do I have to convert it myself > > somehow? > > Different browsers may return different formats. I think that in IE if > the background is set to "green" then currentStyle will return > "green". If the background is set to hex then hex will be returned. In > Firefox it will return RGB in both cases, I believe.So for IE there is a requirement to implement a look-up table where colour keywords have been used. The 17 CSS 2.1 colours are here: <URL: http://www.w3.org/TR/CSS21/syndata.html#color-units > IE''s extended set of 140 named colours (which includes the 17 CSS 2.1 colours) are listed here (IE only page at MSDN): <URL: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/colors/colors_name.asp>IE also allows the use of 28 different user-defined named system colours, as well as 7 user-defined system colour combinations. -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---