Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

rgb to hex javascript

// Convert RGB to Hex
function getColorFun(r, g, b) {
   return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}

getColorFun(178, 232, 55);
// The output here is #b2e837
 
PREVIOUS NEXT
Tagged: #rgb #hex #javascript
ADD COMMENT
Topic
Name
9+4 =