Skip to content

Instantly share code, notes, and snippets.

@tanjo
Last active November 1, 2019 10:10
Show Gist options
  • Save tanjo/77fb4a1b4c3d8258ee4cbad17cdc65b3 to your computer and use it in GitHub Desktop.
Save tanjo/77fb4a1b4c3d8258ee4cbad17cdc65b3 to your computer and use it in GitHub Desktop.
rgb(0, 1, 2) から HEX に変換するスクリプト
["rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)"]
.map((e) => "#" + e.style.borderTopColor
.replace(/rgb/g, '')
.replace(/\(/g,'')
.replace(/\)/g,'')
.replace(/ /g,'')
.split(',')
.map((e) => ("0" + parseInt(e).toString(16)).slice(-2))
.join(''))
.join(" ");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment