Skip to content

Instantly share code, notes, and snippets.

@oguzhancvdr
Created October 22, 2022 19:55
Show Gist options
  • Save oguzhancvdr/b0c8bfc8052802460bbab078471887c3 to your computer and use it in GitHub Desktop.
Save oguzhancvdr/b0c8bfc8052802460bbab078471887c3 to your computer and use it in GitHub Desktop.
const rgbToHex = (r, g, b) => "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
rgbToHex(255, 255, 255);
// #ffffff
@oguzhancvdr
Copy link
Author

Convert RGB to Hex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment