8 Bit RGB HEX to 16 bit RGB actual value

I needed this to convert from 8 bit RGB supplied as hex to something I could use in AppleScript Studio (which seems to require 16 bit actual value RGB).

OS version: Any

on HEX2RGB(RGB_Hex)
	
	-- Expects RGB 8 bit hex without the #
	
	set RGB_List to {}
	
	set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
	
	
	set HEXpairs to {{characters 1 thru 2 of RGB_Hex as string}, {characters 3 thru 4 of RGB_Hex as string}, {characters 5 thru 6 of RGB_Hex as string}}
	
	repeat with NextPair in HEXpairs
		
		repeat with x from 1 to (count of item in hex_list)
			if ((character 1 of (NextPair as string))) is ((item x of hex_list) as string) then
				set x to (x - 1)
				exit repeat
			end if
		end repeat
		
		repeat with y from 1 to (count of item in hex_list)
			if ((character 2 of (NextPair as string))) is ((item y of hex_list) as string) then
				set y to (y - 1)
				exit repeat
			end if
		end repeat
		
		set ThisNum to ((x * 16) + (y * 1)) -- this gives 8 bit RBG
		set ThisNum to ThisNum * 257 -- This gives 16 bit RBG
		
		set RGB_List to RGB_List & ThisNum
		
	end repeat
	
	return RGB_List
	
end HEX2RGB