This file contains 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
/** | |
* Convert #1a2b3c to { h: 210, g: 40, b: 17 } | |
* @param {string} hex | |
* @returns {*} | |
* @see https://stackoverflow.com/q/46432335/3027390 | |
* @see https://stackoverflow.com/a/46432866/3027390 | |
*/ | |
function hexToHsl(hex) { | |
const rgb = _f.hexToRgb(hex); | |
const r = rgb.r / 255; |
This file contains 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
/** | |
* Convert #1a2b3c to { r: 26, g: 43, b: 60 } | |
* @param {string} hex | |
* @returns {*} | |
* @see https://stackoverflow.com/a/5624139 | |
*/ | |
function hexToRgb(hex) { | |
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | |
return result ? { |
OlderNewer