Hex-to-RGB Conversion

[Total: 0    Average: 0/5]

Converts hex color code to rgb.

Body Code:

<h3 align="center"><font face="Verdana,Arial,Helvetica,sans-serif" color="#000099">Hex-to-RGB Conversion</font></h3>

<script language="JavaScript">
R = HexToR("#FFFFFF");
G = HexToG("#FFFFFF");
B = HexToB("#FFFFFF");

function HexToR(h) { return parseInt((cutHex(h)).substring(0,2),16) }
function HexToG(h) { return parseInt((cutHex(h)).substring(2,4),16) }
function HexToB(h) { return parseInt((cutHex(h)).substring(4,6),16) }
function cutHex(h) { return (h.charAt(0)=="#") ? h.substring(1,7) : h}


<div align="left">
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <td width="100%" align="center">
<form name=rgb>
<input type=text name=hex size=8 value="FFFFFF">
<input type=button name=btn value="Convert to RGB"
R:<input type=text name=r size=3>
G:<input type=text name=g size=3>
B:<input type=text name=b size=3>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *