Skip to content

Instantly share code, notes, and snippets.

@mrroot5 mrroot5/rgb2hex.js
Created May 14, 2019

What would you like to do?
RGB a hexadecimal
const RGBToHex = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0');
RGBToHex(255, 165, 1); // 'ffa501'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.