Created
May 14, 2019 06:03
-
-
Save mrroot5/640fa21bca4776d5290720136ac461ba to your computer and use it in GitHub Desktop.
RGB a hexadecimal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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