Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Arvin iuunhao
Added: Jun 18, 2018 8:38 AM
Views: 7
Tags: js
Hex转RGB
  1. const hexToRgb = hex => `rgb(${hex.slice(1).match(/.{2}/g).map(x => parseInt(x, 16)).join()})`
  2. // hexToRgb('#27ae60') -> 'rgb(39,174,96)'