Skip to content

Instantly share code, notes, and snippets.

@chrdek
Created February 8, 2022 20:29
Show Gist options
  • Save chrdek/4c2e7d8853174bd0e88499ee9948ec95 to your computer and use it in GitHub Desktop.
Save chrdek/4c2e7d8853174bd0e88499ee9948ec95 to your computer and use it in GitHub Desktop.
RGB Color to Hexadecimal counterpart in js
rgb2hex = s => s.match(/[0-9]+/g).reduce((x,y) => x + (y|256).toString(16).slice(1),'0x');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment