Jump to content

Recommended Posts

Posted

Ok probably not the right forum to post this in but ho hum.

 

After viewing some of my inline CSS using Firefox's view selection source feature I noticed the colour had been changed from hex (#F00) to rgb (rgb(255,0,0)) and this got me thinking about how browsers work. It makes sense to me that a web browser must convert a colour code into something easier for it to use to create the correct colour and surely rgb(###,###,###) is what they use?

 

So I'm asking this. Do you think there is a speed boost, no matter how small, in rendering if you use rgb for colour specification instead of hex or names? And yes I could just download the Firefox source code and look for myself but thats a mighty lot of code.

Posted

Personnaly, no I dont think there is.

 

Reason being, HTML is designed to use hex and there must have been a reason to do this rather then using RGB. I am guessing the RGB is a later addtition, and normally this means to browsers, a slower type of code.

 

Again, thats just my thinking, no hard facts

 

JimE

Posted

I couldn't find anything definitive. Consider this, though. What I am assuming is a trivial difference in speed will be overshadowed by this:

#FA4 - 4 characters

#FFAA44 - 7 characters

rgb(234.138,134) - 16 characters (not valid numbers for the same values - I just made them up)

 

The time to download the latter should more than make up for using the shorter and easier to grok hex notation.

 

Besides, if your pages are optimized to the point that the difference makes a significant improvement in your site load time, you need to get out and get a life my friend. :) (You know I'm kidding! It's fun to optimize for the sake of it sometimes.)

Posted

Yeah I'm not making a big issue out of it but it's always fun to try and optimise. Like using single quotes instead of double quotes for strings in PHP.

Posted

Remember when you use an external style sheet

most browsers cache the file,

so I don't think load time is an issue.

So its a matter of preference and what you feel is easier to use for you.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...