Skip to content

u/chmbrln

In this archive from May 2012 to Mar 2023

1
posts
6
comments
0
media
7
score

Top posts

Top comments

Ok, quick tutorial on hex conversions to rgb (and vice versa).

Hex is 3 bytes. A hex code of #000000 is actually 3 bytes: 00 00 00.

A byte is made of 8 bits (as everyone knows) and a hex code is a simple way of describing 1 byte.

Hexadecimal goes to 15 (16 if you include 0 - 0-9 + ABCDEF = 16 digits). So the first part of the hexcode is the first four bits and the second is the next 4.

So, let's take a hexcode of 3F as an example.

3 is 3; which in bits is 0011. How do I figure that? A byte is just a number and each bit represents 1 2 4 8 16 32 64 128 making a total of 255 (256 if you include 0). Remember though, that in binary, you count backwards.

So if you took the first four bits (8 4 2 1), it'd equal 15 - the same as a hex code.

so hex code 3 = 3

8 4 2 1

0 0 1 1

and hex code F = 15

8 4 2 1

1 1 1 1

So the total byte is:

8 4 2 1 | 8 4 2 1

0 0 1 1 | 1 1 1 1

OR

0 0 1 1 1 1 1 1

Now, from binary back to decimal is easy, you just count the total of the byte, except the byte counts backwards:

128 64 32 16 8 4 2 1

0 0 1 1 1 1 1 1

= 1+2+4+8+16+32 = 63

So 3F = 63 - AND THIS IS YOUR RGB NUMBER.

A colour hex code is 3 bytes, so #3F3F3F will equal 63 Red, 63 Green and 63 Blue.

Probably not really anything to do with the OP's original post, but hopefully may help someone out there and highlight that there really is no difference between hex codes and RGB. The web works in RGB because it's on a screen.

Print needs to deal with ink and ink comes in four primary colours (cyan, magenta, yellow and black). With this combination you can make any colour.

RGB is the primary colours for light. Combining red, green and blue will make any colour coming out of the screen.

So if you're doing web-design, ALWAYS work with RGB. Print, then work with CYMK.

3 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.