Created
September 2, 2022 09:26
-
-
Save sakshstore/ba71816414448f67da17ef05af14c517 to your computer and use it in GitHub Desktop.
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"); | |
// Usage | |
rgbToHex(255, 0, 0); // #ff0000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment