chevron_left chevron_right
Login Register invert_colors photo_library Stay updated and chat with others! - Join the Discord!
• 0 Vote(s) - 0 Average

 Converting RGB to Hexadecimal filter_list Linear Mode Threaded Mode View a Printable Version Author Message
Converting RGB to Hexadecimal #1
This is an easy mathimatical process to get RGB to convert over to hexadecemical values.

We need to remember that hexadecimal is a base16 numeric couting system. This means that whatever we convert over to hexadecimal is ALWAYS divided by 16. When counting, we use base10. Base10 means that we count from 1 - 9, then start using double digits, then trible, so on and so forth.

When counting in base16, we count from 1 to 9 and then use letters. Using hexadecimal for colours, we ALWAYS only EVER go to 15. I know, it's a weird system, just go with it.

Here's a little chart I made for you guys to go by when converting to hexadecimal, just in case you can't remember how it works. It's fairly easy, I don't really know how you wouldn't know this but it's still there if you need it.

Spoiler:
10 = A
11 = B
12 = C
13 = D
14 = E
15 = F

Now that we know everything that's needed, we can start working the math to convert it.

We get our value for R and divide it by 16. If you use calculator for this, you will have a decimal remainder. If you do have a decimal remainder, just multiply the decimal by 16.

We now have to numbers, a remainder that has been multiplied by 16, and the base number without the decimal.

All we do to convert it over is put it together. Use the chart or base16 numeric counting system for this.

Example:
Spoiler:
If you has 255 as a value, without muliplying the remainder, you would have 15.9375.
0.9375 * 16 = 15
255 = 15(Base number) + 15(Remainder after multiplying it) = FF

You use the same mathematical process for all values to get your hexadecimal value.

Example:
Spoiler:
255,0,0

==================
255 / 16 = 15.9375
0.9375 * 16 = 15
15, 15 = FF
==================
0 / 16 = 0
0, 0 = 00
==================
0 / 16 = 0
0, 0 = 00
==================

End value:
#FF0000

FF0000 = RED
255,0,0 = RED

Drop you comments and shit below, hope this helped your graphics designers and such.

If you would like a pre-made program that does this for you because you're lazy, click [here]

RE: Converting RGB to Hexadecimal #2
Nice tutorial, might just start doing this instead on relying on the Internet. Thanks ^^ RE: Converting RGB to Hexadecimal #3
awesome tutorial bro, love it.  Users browsing this thread: 1 Guest(s)