It takes input in the form of values for Red, Green and Blue ranging from 0 to 255 and then converts those values to a hexadecimal string that can be used to specify color in html/css code.
› RGB to HEX
RGB
HEX
RGB
The RGB color model is an additive color model in which red, green and blue light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three additive primary colors, red, green and blue.
RGB has 3 light channels: Red, Green, Blue. And every channel have value from 0 to 255. For example: RGB (255, 0, 0) is Red, because Red is turned on with max value, but Green and Blue is turned off by minimal value 0.
h1 { color: rgb(255, 0, 0); } /* red */h2 { color: rgb(0, 255, 0); } /* green */h3 { color: rgb(0, 0, 255); } /* blue */h4 { color: rgb(0%, 0%, 100%); } /* same blue with percents */
RGBA
The RGBA color model is same as RGB, but it contain alpha channel. RGBA has Red, Green, Blue and Alpha values. Alpha contain values from 0 to 1. If you want make 50% alpha, you need to write 0.5 in alpha channel.
h1 { color: rgb(0, 0, 255); } /* blue in RGB */h2 { color: rgba(0, 0, 255, 1); } /* blue in RGBA, not transparent: 100% */h3 { color: rgba(0, 0, 255, 0.5); } /* not transparent: 50% */h4 { color: rgba(0, 0, 255, .155); } /* not transparent: 15.5% */h5 { color: rgba(0, 0, 255, 0); } /* fully transparent */
HEX
The color model can also be written in HEX format. Colors in HEX most popular in web design. HEX format has 6 symbols and each two symbol is make one of color channel. For example RGB(255,255,0) in HEX is #FFFF00. Where every 255 is same as FF and 0 same as 00.
h1 { color: #ff0000; } /* red */h2 { color: #00ff00; } /* green */h3 { color: #0000ff; } /* blue */h4 { color: #00f; } /* blue, shortly format */