Last active
May 24, 2024 17:04
-
-
Save alekstar79/bbb2ba0042b60b93f01937adcb6d814b to your computer and use it in GitHub Desktop.
RGB to HEX
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
/** | |
* @param {{r: number, g: number, b: number}} | |
* @return {string} | |
*/ | |
export function rgbToHex({ r, g, b }) | |
{ | |
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment