For example, if I have an RGB value of 66, 135, 245 which translates to #4287f5, how would I get the int(16) Little Endian value?
Javascript allows bit-shifts, but be careful with operator precedence. The parentheses are necessary here.
function colorInteger(r,g,b){
return (r<<16) + (g<<8) + b
}
Now colorInteger(66,135,245) gives 4360181
And '#' + colorInteger(66,135,245).toString(16) gives "#4287f5"
To get an integer from the hexadecimal value (without #), you can use parseInt('4287f5',16). You can recover the r,g,b values from that using bit operations, too.
function getRGB(hexadecimal_string){
let intVal = parseInt(hexadecimal_string,16);
let r = intVal >> 16;
let g = (intVal >> 8) & 0xff
let b = intVal & 0xff
return [r,g,b]
}
I'm not sure if I understand your intention, but from the answer in another thread ( Byte order for packed images ) one single integer like ARGB is represented as [B,G,R,A] in little-endian machines.