carbonize Posted August 2, 2006 Posted August 2, 2006 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. Quote
TCH-JimE Posted August 2, 2006 Posted August 2, 2006 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 Quote
Deverill Posted August 2, 2006 Posted August 2, 2006 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.) Quote
carbonize Posted August 2, 2006 Author Posted August 2, 2006 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. Quote
TCH-Don Posted August 2, 2006 Posted August 2, 2006 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.