Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which one is faster: hex color codes or color names?

Tags:

css

hex

colors

I just wanted to know if it's faster to use hex color codes or the color names when I want to use it in CSS?

like image 458
2hamed Avatar asked Jul 10 '11 10:07

2hamed


People also ask

Why would you use a hexadecimal value instead of the name of a color?

Hex color codes are one type of HTML color code that you'll often hear referred to as hexadecimal color or hex. The reason to use hexadecimal numbers is it's a human-friendly representation of values in binary code.

Is hex code still used?

Why Is the Hex Color Code So Popular? While there are several different color models (RGB, CMYK, HSL), hex color codes are perhaps the most widely used representation. This is because they are simple and easy to understand.

Are color codes in hexadecimal?

The most used Color codes are Hex codes. Hex codes are three-byte hexadecimal numbers (consist of six variables), with a pair of characters in the Hex code, representing the intensity of red, green, and blue in the color respectively.

Are all color codes the same?

Yes, they are the same. Up to 30% of paint codes have multiple color names. However, it is important to always use the paint code when ordering your automotive touch up paint, never the color name. The same color name can be used across car manufacturers but have different paint formulas.


1 Answers

My guess is the codes will be faster since the names are probably assigned to a look-up table and reference hex codes anyway.

That being said, my guess is the speed difference will be completely negligible.

Here's a performance test I just created. They're neck and neck, though hex codes seems to be just barely faster on 4/5 runs so far: http://jsperf.com/css-color-names-vs-hex-codes

like image 114
AlienWebguy Avatar answered Nov 15 '22 21:11

AlienWebguy