256 Kilobytes

How Hex Colors Work

Articles in Style and Layout | By August R. Garcia

Published 2 weeks agoSun, 31 Mar 2019 19:16:19 -0700

106 views, 0 RAMs, and 0 comments

Using the digits 000000 to FFFFFF, hexadecimal color codes are used to represent nearly every color seen on the Internet. Here is how hexadecimal colors actually work.

How Hexadecimal Colors Work

In hexadecimal, the numbers A through F are used to extend the base-10 decimal system to a base-16 system:

  • 0 = 0
  • 1 = 1
  • [...]
  • 9 = 9
  • A = 10
  • B = 11
  • C = 12
  • D = 13
  • E = 14
  • F = 15

A hex color is equivalent to an RGB color:

  • RGB(0,0,0) is the same as #000000
  • RGB(255,255,255) is the same as #FFFFFF

A hex color consists of three sets of two hexadecimal digits. The first two are the amount of red, the second two are the amount of green, and the last two are the amount of blue.

  • FF = 255

Decimal to Hexadecimal Conversion

Note that while this converter is limited to hexadecimal numbers from 000000 to FFFFFF, hexadecimal can be used to represent any number that can be represented using decimal notation.

 

Also note that hexadecimal as a general concept does not require padding zeros to six positions. This is a convention used for denoting hexadecimal colors.

Why the R, G, and B are between 0 and 255

The reason why the max is 255 is because:

  1. A byte of data is eight bits
  2. ight bits is equal to 2^8 possible values
  3. 2^8 = 256
  4. Since 0 is one of the 256 possible values, a byte frequently represents an integer from 0 to 255

The point being that a hexadecimal color has one byte of data for each of the the R G and B values.

Download more RAM. 🐏 ⨉ 0 Posted by August R. Garcia 2 weeks ago 🕓 Posted at 31 March, 2019 19:16 PM PDT

Profile Photo - August R. Garcia August R. Garcia LARPing as a Sysadmi... Portland, OR
🗎 104 🗨 620 🐏 116
Site Owner

Grahew Mattham

August Garcia is some guy who used to sell Viagra on the Internet. He made this website to LARP as a sysadmin while posting about garbage like user-agent spoofing, spintax, the only good keyboard, virtual assitants from Pakistan, links with the rel="nofollow" attributeproxies, regular expressions, HTML and CSSsin, the developer console, and probably some other trash.


Account created 4 months ago.
104 posts, 620 comments, and 116 RAMs.

Last active 6 hours ago:
Commented in thread Best Subreddits about SEO?

Post a New Comment

To leave a comment, login to your account or create an account.

Do you like having a good time?

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account
You can also login to an existing account or recover your password. All use of this site is subject to terms outlined in the terms of service and privacy policy.