A Test to find out which way to convert a string hex to RGB is better.
Download this github as a zip, unzip it, and open the index.html file.
If you can open up DevTools (CTRL + SHIFT + I), do that, and click on the button labeled Test.
If you cannot open DevTools due to restrictions, check the box that is labeled No DevTools, then click on the button labeled Test.
If you want to look at the the Main Source Code (The class that I made that I stripped these functions from), it is available in the ColorsClass.js file.